Commit a0235647 authored by 吕雯燕's avatar 吕雯燕

Merge branch 'duiba_wenyan' into develop

parents efb8a4b4 d4c2a34e
......@@ -61,7 +61,26 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
}else
if(method.getName().equals("新建自有手动开奖活动")){
result = new Object[][]{
new Object[]{1,"10","everyday","5","everyday","//yun.duiba.com.cn/upload/mhty76ri9b.png","新建自有手动开奖--每日次数"},
new Object[]{1,"10","everyday","5","everyday","//yun.duiba.com.cn/upload/mhty76ri9b.png","新建自有手动开奖--每日次数"}, //case1
new Object[]{2,"20","forever","10","forever","//yun.dui88.com/images/201811/j90o37xiof.jpg","新建自有手动开奖--永久次数"}, //case2
};
}else
if(method.getName().equals("新建自有答题活动")){
result = new Object[][]{
new Object[]{1,"[{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"1\",\"show\":true,\"arealimit\":false,\"pronumber\":\"1\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172178,\"name\":\"【勿动】自有优惠券审核通过测试\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"2\",\"show\":true,\"arealimit\":false,\"pronumber\":\"2\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175491,\"name\":\"【自动化】自有实物19:51:09\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"3\",\"show\":true,\"arealimit\":false,\"pronumber\":\"3\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"remaind\":\"80\"},{\"type\":\"phonebill\",\"title\":\"话费\",\"img\":\"//yun.duiba.com.cn/upload/AROxS1462438316966.png\",\"valid\":true,\"probability\":\"4\",\"show\":true,\"arealimit\":false,\"pronumber\":\"4\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"remaind\":\"70\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"5\",\"show\":true,\"arealimit\":false,\"pronumber\":\"5\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"remaind\":\"60\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"6\",\"show\":true,\"arealimit\":false,\"pronumber\":\"6\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"remaind\":\"50\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"0\",\"show\":false,\"arealimit\":false,\"pronumber\":\"0\",\"alipay\":\"\",\"description\":\"\"}]",
"[{\"index\":null,\"type\":\"text\",\"rightAnswer\":1,\"name\":\"文字题一\",\"option1\":\"文字题一A\",\"option2\":\"文字题一B\",\"option3\":\"文字题一C\",\"option4\":\"文字题一D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"2\",\"name\":\"文字题二\",\"option1\":\"文字题二A\",\"option2\":\"文字题二B\",\"option3\":\"文字题二C\",\"option4\":\"文字题二D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"3\",\"name\":\"文字题三\",\"option1\":\"文字题三A\",\"option2\":\"文字题三B\",\"option3\":\"文字题三C\",\"option4\":\"文字题三D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"4\",\"name\":\"文字题四\",\"option1\":\"文字题四A\",\"option2\":\"文字题四B\",\"option3\":\"文字题四C\",\"option4\":\"文字题四D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":1,\"name\":\"文字题五\",\"option1\":\"文字题五A\",\"option2\":\"文字题五B\",\"option3\":\"文字题五C\",\"option4\":\"文字题五D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"2\",\"name\":\"文字题六\",\"option1\":\"文字题六A\",\"option2\":\"文字题六B\",\"option3\":\"文字题六C\",\"option4\":\"文字题六D\"}]",
"1","10","everyday","5","everyday","6","新建自有答题活动-文字题"}, //case 1
new Object[]{2,"[{\"type\":\"coupon\",\"title\":\"优惠券1\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"1\",\"show\":true,\"arealimit\":false,\"pronumber\":\"1\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"2\",\"show\":true,\"arealimit\":false,\"pronumber\":\"2\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172163,\"name\":\"【勿动】兑吧优惠券定向库存不足\",\"remaind\":\"60\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"3\",\"show\":true,\"arealimit\":false,\"pronumber\":\"3\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":185571,\"name\":\"【自动化】自有优惠券成功页跳转链接 兑换成功后页面没有跳转按钮 以及点击入口\",\"remaind\":\"30\"}]",
"[{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题1\",\"option1\":\"//yun.dui88.com/images/201811/0tg3occ8ft.png\",\"option2\":\"//yun.dui88.com/images/201811/7avinswhbx.png\",\"option3\":\"//yun.dui88.com/images/201811/wpivlzrt5x.png\",\"option4\":\"//yun.dui88.com/images/201811/omk617xseb.png\"},{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题2\",\"option1\":\"//yun.dui88.com/images/201811/x7ukissn3k.png\",\"option2\":\"//yun.dui88.com/images/201811/3g81rrei8x.png\",\"option3\":\"//yun.dui88.com/images/201811/m16yaakc6u.png\",\"option4\":\"//yun.dui88.com/images/201811/kodb08cqi3.png\"},{\"index\":null,\"type\":\"image\",\"rightAnswer\":1,\"name\":\"图片题3\",\"option1\":\"//yun.dui88.com/images/201811/au84gljudk.png\",\"option2\":\"//yun.dui88.com/images/201811/vt9wfrnefk.png\",\"option3\":\"//yun.dui88.com/images/201811/tzplflmd8e.png\",\"option4\":\"//yun.dui88.com/images/201811/n5odjivu2j.png\"}]",
"1","5","forever","20","forever","3","新建自有答题活动-图片题"},//case 2
};
}else
if(method.getName().equals("新建自有答题独立活动")){
result = new Object[][]{
new Object[]{1,"[{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"1\",\"show\":true,\"arealimit\":false,\"pronumber\":\"1\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172178,\"name\":\"【勿动】自有优惠券审核通过测试\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"2\",\"show\":true,\"arealimit\":false,\"pronumber\":\"2\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175491,\"name\":\"【自动化】自有实物19:51:09\",\"remaind\":\"50\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"3\",\"show\":true,\"arealimit\":false,\"pronumber\":\"3\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159849,\"value\":\"DUIBA_SELF\",\"remaind\":\"10\"}]",
"[{\"index\":null,\"type\":\"text\",\"rightAnswer\":1,\"name\":\"文字题1\",\"option1\":\"文字题1A\",\"option2\":\"文字题1B\",\"option3\":\"文字题1C\",\"option4\":\"文字题1D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"2\",\"name\":\"文字题2\",\"option1\":\"文字题2A\",\"option2\":\"文字题2B\",\"option3\":\"文字题2C\",\"option4\":\"文字题2D\"},{\"index\":null,\"type\":\"text\",\"rightAnswer\":\"3\",\"name\":\"文字题3\",\"option1\":\"文字题3A\",\"option2\":\"文字题3B\",\"option3\":\"文字题3C\",\"option4\":\"文字题3D\"}]",
"0","","everyday","12","everyday","3","新建自有答题独立活动-文字题"}, //case1
};
}
......@@ -267,6 +286,12 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
logger.info("校验新建自有手动开奖-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"10","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimitScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimit"),"20","校验用户抽奖限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimitScope"),"forever","校验用户抽奖限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/j90o37xiof.jpg","校验活动新版banner图失败");
logger.info("校验新建自有手动开奖-2内容成功");
break;
}
......@@ -277,6 +302,127 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
}
/**
* @param caseNum 用例编号
* @param awards 奖品
* @param questionRecord 题目
* @param creditsType 活动模式
* @param freeLimit 免费次数
* @param freeScope 免费次数类型
* @param limitCount 限制次数
* @param limitScope 限制次数类型
* @param optionNum 题目数
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 新建自有答题活动(int caseNum,String awards,String questionRecord,String creditsType,String freeLimit,String freeScope,String limitCount,String limitScope,String optionNum,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有答题活动"+data;
//新建自有答题活动
developerService.saveQuestion(title,awards,questionRecord,creditsType,freeLimit,freeScope,limitCount,limitScope,optionNum);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editQuestion(id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"22","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"10","校验活动免费次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"5","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"everyday","校验活动限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[0].name"),"文字题一","校验活动题目名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[0].type"),"text","校验活动题目类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[0].name"),"【勿动】自有优惠券审核通过测试","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[0].probability"),"1","校验活动奖品获奖资格失败");
logger.info("校验新建自有答题活动-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"5","校验活动免费次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"20","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"forever","校验活动限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[0].name"),"图片题1","校验活动题目名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[0].type"),"image","校验活动题目类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].name"),"【勿动】兑吧优惠券定向库存不足","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].probability"),"2","校验活动奖品获奖资格失败");
logger.info("校验新建自有答题活动-2内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
/**
* @param caseNum 用例编号
* @param awards 奖品
* @param questionRecord 题目
* @param creditsType 活动模式
* @param freeLimit 免费次数
* @param freeScope 免费次数类型
* @param limitCount 限制次数
* @param limitScope 限制次数类型
* @param optionNum 题目数
* @param caseName 用例名称
* @throws Exception
*/
// @Test(dataProvider = "providerMethod")
public void 新建自有答题独立活动(int caseNum,String awards,String questionRecord,String creditsType,String freeLimit,String freeScope,String limitCount,String limitScope,String optionNum,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有答题独立活动"+data;
//新建自有答题活动
developerService.saveQuestion(title,awards,questionRecord,creditsType,freeLimit,freeScope,limitCount,limitScope,optionNum);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editQuestion(id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.creditsType"),"0","校验活动积分类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"12","校验活动免费次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"12","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"everyday","校验活动限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mode"),"free","校验活动模式失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[1].name"),"文字题2","校验活动题目名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.questionRecord[1].type"),"text","校验活动题目类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].name"),"【自动化】自有实物19:51:09","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].probability"),"2","校验活动奖品获奖资格失败");
logger.info("校验新建自有答题独立活动-1内容成功");
break;
case 2:
break;
}
//删除测试数据
this.删除自有活动(title);
}
//删除自有活动
public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动
......
......@@ -1110,4 +1110,66 @@ public class DeveloperService {
return response;
}
//保存自有答题活动--所有字段
public Response saveQuestion(String title,String awards,String questionRecord,String creditsType,String freeLimit,String freeScope,String limitCount,String limitScope,String optionNum) throws Exception {
String url=hdHost+"/question/save";
Map<String,String> map = new HashMap<>();
map.put("subType","question");
map.put("title",title);
map.put("anticheatExchangeLimit","true");
map.put("awards",awards);
map.put("questionRecord",questionRecord);
map.put("credits","22");
map.put("creditsType",creditsType);
map.put("banner","//yun.duiba.com.cn/upload/S2T4p1474356849960.png");
map.put("thumbnail","//yun.duiba.com.cn/upload/ljoka1474356876322.png");
map.put("bannerImgNew","//yun.duiba.com.cn/upload/qzfsmsyo9s.png");
map.put("appId","2239");
map.put("freeLimit",freeLimit);
map.put("freeScope",freeScope);
map.put("limitCount",limitCount);
map.put("limitScope",limitScope);
map.put("optionNum",optionNum);
map.put("autoOffDate","2020-12-08 00:00");
map.put("id","");
logger.info("创建自有答题活动:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("创建自有答题活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("创建自有答题活动接口失败,返回信息:"+response.asString());
}
return response;
}
//编辑自有答题活动
public Response editQuestion(String actId) throws Exception {
String url=hdHost+"/question/editData";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("actId",actId);
map.put("type","question");
logger.info("请求编辑自有答题活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).post("http://"+url);
response.prettyPrint();
try{
Assert.assertEquals(response.jsonPath().getString("desc"),"成功");
}catch(Exception e){
throw new Exception("编辑自有答题活动接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("编辑自有答题活动接口失败,返回信息:"+response.asString());
}
return response;
}
}
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