Commit d8e4aef3 authored by 赵然's avatar 赵然

Merge branch 'zr' into develop

parents 95ed0a4e 1ee13797
......@@ -387,7 +387,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建活动楼层皮肤" })
@Test
public void B_手机端活动() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -444,7 +444,7 @@ public class ActiveGroup_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_手机端活动" })
@Test
public void C_删除活动楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -154,7 +154,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建banner楼层皮肤" })
@Test
public void B_banner楼层活动校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -212,7 +212,7 @@ public class Banner_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_banner楼层活动校验" })
@Test
public void C_banner商品校验() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......
......@@ -342,7 +342,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建优惠券楼层皮肤" })
@Test
public void B_优惠券手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -392,7 +392,7 @@ public class Coupon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_优惠券手机端" })
@Test
public void C_删除优惠券楼层皮肤() throws Exception {
......
......@@ -230,7 +230,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建游戏楼层皮肤" })
@Test
public void B_游戏手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -272,7 +272,7 @@ public class Game_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_游戏手机端" })
@Test
public void C_删除游戏楼层皮肤() throws Exception {
......
......@@ -222,7 +222,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_创建icon楼层皮肤" })
@Test
public void B_icon添加图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -296,7 +296,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_icon添加图标" })
@Test
public void C_icon编辑图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -352,7 +352,7 @@ public class Icon_FloorTest extends DuibaTestBase {
Assert.assertEquals(map.get("logo"),"//yun.dui88.com/images/201806/9lz5ifre0h.png","今日必抢logo校验错误");
}
@Test(dependsOnMethods = { "C_icon编辑图标" })
@Test
public void D_icon删除图标() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -388,7 +388,7 @@ public class Icon_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "D_icon删除图标" })
@Test
public void E_删除icon楼层皮肤() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......
......@@ -362,7 +362,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_item创建楼层皮肤" })
@Test
public void B_item手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -404,7 +404,7 @@ public class Item_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_item手机端" })
@Test
public void C_item删除楼层皮肤() throws Exception {
......
......@@ -806,7 +806,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
response = floorService.switchOpenState(authorization.ssoLogin(),skinId,"true");
}
@Test(dependsOnMethods = { "A_Seckill创建楼层皮肤" })
@Test
public void B_Seckill手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -849,7 +849,7 @@ public class Seckill_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_Seckill手机端" })
@Test
public void C_Seckill删除楼层皮肤() throws Exception {
......
......@@ -244,7 +244,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_Showcase创建楼层皮肤" })
@Test
public void B_Showcase手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
......@@ -289,7 +289,7 @@ public class Showcase_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_Showcase手机端" })
@Test
public void C_Showcase删除楼层皮肤() throws Exception {
......
......@@ -510,7 +510,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "A_sign创建楼层皮肤" })
@Test
public void B_sign手机端() throws Exception {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");//设置日期格式
logger.info(df.format(new Date()));
......@@ -545,7 +545,7 @@ public class Sign_FloorTest extends DuibaTestBase {
}
@Test(dependsOnMethods = { "B_sign手机端" })
@Test
public void C_sign删除楼层皮肤() throws Exception {
......
......@@ -28,6 +28,19 @@ public class 补给站_活动_DuibaTest extends AbstractTestNGSpringContextTests
//添加活动
@Test(description = "//添加活动")
public void a_添加活动() throws Exception{
//查询订单列表
Response orderResponse = developerBJZ.selectOrders("1",appId);
String id = orderResponse.jsonPath().getString("data.list");
logger.info("待付款订单id为:"+id);
if(id.equals("[]")){
logger.info("订购列表无待付款订单");
}else{
id = orderResponse.jsonPath().getString("data.list[0].id");
logger.info("待付款订单id为:"+id);
developerBJZ.cancleOrder(id,appId);
logger.info("待付款订单取消成功");
}
//查询热门活动-活动列表,获取商品ID
Response response=developerBJZ.saasActivitys("3",appId);
String goodItemId= String.valueOf(response.jsonPath().getString("data.saasActivitys[0].id"));
......
/**
* Copyright (C), 2015-2018
* FileName: 购物车测试
* Author: zhaoran
* Date: 2018/12/10 19:45
* Description:
*/
package http.cases.SaasDeveloperTest;
import base.DuibaLog;
import base.DuibaTestBase;
import http.service.Activity.PkService;
import http.service.Authorization;
import http.service.Saas.MallService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
public class 购物车测试 extends DuibaTestBase {
@Value("${activity.host}")
String activityHost;
@Autowired
MallService mallService;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
private static Integer uid = 5415;
@Test
public void 加入购物车() throws Exception{
//获取当前购物车数量
Response response = mallService.getMallCount(uid);
response.prettyPrint();
logger.info("购物车当前的数量为:"+response.jsonPath().getString("data.trolleyItemCount"));
}
}
\ No newline at end of file
......@@ -300,7 +300,7 @@ public class Authorization {
public Map hdLoginSaasNew(String account,String appId){
String path = "/doLoginNew";
int i=10;
logger.info("hdCookiesSaasByApp cookies:"+hdCookiesSaasNew.toString());
logger.info("hdCookiesSaasNew cookies:"+hdCookiesSaasNew.toString());
Map<String,String> hdCookies = hdCookiesSaasNew.get(appId);
while((hdCookies==null||hdCookies.size()==0)&&i>0) {
Response token=this.hdGetToken();
......@@ -328,7 +328,7 @@ public class Authorization {
i--;
}
logger.info("hdCookiesSaasByApp cookies集合:"+hdCookiesSaasNew.toString());
logger.info("hdCookiesSaasNew cookies集合:"+hdCookiesSaasNew.toString());
return hdCookies;
}
......
package http.service.Saas;
import base.DuibaLog;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import http.service.Authorization;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.testng.Assert;
import java.util.HashMap;
import java.util.Map;
import static io.restassured.RestAssured.given;
/**
* Created by zhaoran on 2018/12/19.
*/
@Service
public class MallService {
@Value("${activity.host}")
String activityHost;
@Autowired
Authorization authorization;
private DuibaLog logger = DuibaLog.getLogger();
//获取购物车列表商品
public Response mallget(Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/shopping-trolley/get";
Response response=given().cookies(authorization.dafuwengLogin(uid)).get(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("购物车列表接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("购物车列表接口失败,返回信息:"+response.asString());
}
return response;
}
//获取购物车列表商品
public Response getMallCount(Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/market-activity/getMallCount";
Response response=given().cookies(authorization.dafuwengLogin(uid)).get(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("购物车数目接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("购物车数目接口失败,返回信息:"+response.asString());
}
return response;
}
// 加入购物车
public Response malladd(String appItemId,Integer uid) throws Exception {
String url = activityHost+"/mall-api/consumer/shopping-trolley/add";
Map<String,String> map = new HashMap<>();
map.put("appItemId",appItemId);
JSONObject jsonParam = JSONObject.parseObject(JSON.toJSONString(map));
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.dafuwengLogin(uid)).body(jsonParam).post(url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("添加购物车接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("添加购物车接口失败,返回信息:"+response.asString());
}
return response;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment