Commit abaa7988 authored by 钱雯君's avatar 钱雯君

Merge branch 'develop' into qwj_181029

parents ec4bfb9d 1ba44b2e
...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase { ...@@ -267,7 +267,6 @@ public class 创建自有活动_DuibaTest extends DuibaTestBase {
} }
//删除自有活动 //删除自有活动
public void 删除自有活动(String title) throws Exception{ public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动 //开发者删除自有活动
......
package http.cases.DeveloperTest;
import base.DuibaTestBase;
import org.testng.annotations.DataProvider;
import utils.PublicMethod;
import http.service.Activity.ManagerService;
import http.service.Activity.NewActivityService;
import http.service.Activity.SingleLotteryService;
import http.service.hd.DeveloperService;
import http.service.hd.SigninService;
import utils.MatcherString;
import base.DuibaLog;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
/**
* Created by lvwenyan on 2018/11/23.
*/
public class 新建活动测试_DuibaTest extends DuibaTestBase{
@Autowired
DeveloperService developerService;
private static DuibaLog logger = DuibaLog.getLogger();
@DataProvider
public Object[][] providerMethod(Method method){
Object[][] result = null;
if(method.getName().equals("新建自有积分商城活动工具")) {
result = new Object[][]{
new Object[]{1, "5","everyday","3","everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"limit\":\"1\",\"low\":\"2\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":177222,\"name\":\"【自动化】自有实物\",\"limit\":\"2\",\"low\":\"3\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"limit\":\"3\",\"low\":\"4\",\"remaind\":\"80\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"limit\":\"4\",\"low\":\"5\",\"remaind\":\"70\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"limit\":\"5\",\"low\":\"6\",\"remaind\":\"60\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"10\",\"show\":false,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"},{\"type\":\"again\",\"title\":\"再抽一次\",\"img\":\"//yun.duiba.com.cn/upload/aJwb11462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"}]"
,"//yun.duiba.com.cn/upload/newHdTool/turntable_cricle/banner_750x220.png","新建自有积分商城活动工具--每日次数"}, //case1
new Object[]{2, "10", "forever", "3","forever","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":169713,\"name\":\"【勿动】兑吧优惠券扣库存\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"10\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172293,\"name\":\"【勿动】兑吧优惠券下载链接兑换记录页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券4\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174797,\"name\":\"【勿动】兑吧优惠券预分配库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券5\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174923,\"name\":\"【勿动】兑吧优惠券共享库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券6\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172292,\"name\":\"【勿动】兑吧优惠券下载链接商家落地页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券7\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":true,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175605,\"name\":\"【勿动】兑吧优惠券地区兑换白名单不可兑\",\"remaind\":\"199\"}]"
,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有积分商城活动工具--永久次数"}, //case2
};
}else
if (method.getName().equals("新建自有独立活动工具")){
result = new Object[][]{
new Object[]{1, "10","everyday","everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"limit\":\"1\",\"low\":\"2\",\"remaind\":\"100\"},{\"type\":\"object\",\"title\":\"实物\",\"img\":\"//yun.duiba.com.cn/upload/1uF0l1462438316968.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":177222,\"name\":\"【自动化】自有实物\",\"limit\":\"2\",\"low\":\"3\",\"remaind\":\"90\"},{\"type\":\"virtual\",\"title\":\"虚拟商品\",\"img\":\"//yun.duiba.com.cn/developer/img/activityTool/slotMachine/virtual.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":178060,\"value\":\"test\",\"limit\":\"3\",\"low\":\"4\",\"remaind\":\"80\"},{\"type\":\"alipay\",\"title\":\"支付宝\",\"img\":\"//yun.duiba.com.cn/upload/KkZMp1462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"1\",\"limit\":\"4\",\"low\":\"5\",\"remaind\":\"70\"},{\"type\":\"qb\",\"title\":\"Q币\",\"img\":\"//yun.duiba.com.cn/upload/mF3wO1462438317114.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"value\":\"10\",\"limit\":\"5\",\"low\":\"6\",\"remaind\":\"60\"},{\"type\":\"lucky\",\"title\":\"福袋\",\"img\":\"//yun.duiba.com.cn/webapp/img/luckynewn.png\",\"valid\":true,\"probability\":\"10\",\"show\":false,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"},{\"type\":\"again\",\"title\":\"再抽一次\",\"img\":\"//yun.duiba.com.cn/upload/aJwb11462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\"}]"
,"//yun.duiba.com.cn/upload/newHdTool/turntable_cricle/banner_750x220.png","新建自有独立活动工具--每日次数"}, //case1
new Object[]{2, "50", "forever", "everyday","[{\"index\":1,\"type\":\"thanks\",\"img\":\"//yun.duiba.com.cn/upload/uP99F1462438316972.png\",\"title\":\"谢谢参与\",\"valid\":true,\"show\":true},{\"type\":\"coupon\",\"title\":\"优惠券\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":159857,\"name\":\"【自动化勿动】自有优惠券\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券2\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":169713,\"name\":\"【勿动】兑吧优惠券扣库存\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券3\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"10\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172293,\"name\":\"【勿动】兑吧优惠券下载链接兑换记录页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券4\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174797,\"name\":\"【勿动】兑吧优惠券预分配库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券5\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":174923,\"name\":\"【勿动】兑吧优惠券共享库存测试\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券6\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":false,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":172292,\"name\":\"【勿动】兑吧优惠券下载链接商家落地页\",\"remaind\":\"100\"},{\"type\":\"coupon\",\"title\":\"优惠券7\",\"img\":\"//yun.duiba.com.cn/upload/bust51462438317113.png\",\"valid\":true,\"probability\":\"10\",\"show\":true,\"arealimit\":true,\"pronumber\":\"\",\"alipay\":\"\",\"description\":\"\",\"appItemId\":175605,\"name\":\"【勿动】兑吧优惠券地区兑换白名单不可兑\",\"remaind\":\"199\"}]"
,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有独立活动工具--永久次数"}, //case2
};
}
return result;
}
/**
* @param caseNum 用例编号
* @param limitCount 限制次数
* @param limitScope 限制次数类型
* @param freeLimit 免费次数
* @param freeScope 免费次数类型
* @param awards 活动奖品
* @param bannerImgNew 新版banner图
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod" )
public void 新建自有积分商城活动工具(int caseNum,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception {
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有活动工具"+data;
//新建自有活动工具
developerService.saveHdAll("","1",title,limitCount,limitScope,freeLimit,freeScope,awards,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editData(id,"turntable_circle","2239");
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"10","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"3","校验活动免费抽奖次数失败");
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.awards[1].name"),"【自动化勿动】自有优惠券","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].limit"),"1","校验活动奖品中奖限制失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].oldRemaind"),"100","校验活动奖品数量失败");
logger.info("校验新建自有活动工具-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"10","校验活动限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"forever","校验活动限制次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeLimit"),"3","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[2].name"),"【勿动】兑吧优惠券扣库存","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/2yyblucaps.jpg","校验活动新版banner图失败");
logger.info("校验新建自有活动工具-2内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
@Test(dataProvider = "providerMethod" )
public void 新建自有独立活动工具(int caseNum,String limitCount,String limitScope,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception {
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有独立活动工具"+data;
//新建自有活动工具
developerService.saveHdAll("","0",title,limitCount,limitScope,"",freeScope,awards,bannerImgNew);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].id"));
//编辑活动,校验活动内容
Response editResponse = developerService.editData(id,"turntable_circle","2239");
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.credits"),"0","校验活动积分失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"10","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"everyday","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].name"),"【自动化勿动】自有优惠券","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].limit"),"1","校验活动奖品中奖限制失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[1].oldRemaind"),"100","校验活动奖品数量失败");
logger.info("校验新建自有独立活动工具-1内容成功");
break;
case 2:
Assert.assertEquals(editResponse.jsonPath().getString("data.limitCount"),"50","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitScope"),"forever","校验活动免费抽奖次数类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.awards[2].name"),"【勿动】兑吧优惠券扣库存","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/2yyblucaps.jpg","校验活动新版banner图失败");
logger.info("校验新建自有独立活动工具-2内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
//删除自有活动
public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动
Response HdResponse = developerService.list2(title);
String actId = HdResponse.jsonPath().getString("data.list[0].id");
developerService.delActivity(actId);
}
}
...@@ -912,4 +912,67 @@ public class DeveloperService { ...@@ -912,4 +912,67 @@ public class DeveloperService {
return response; return response;
} }
//创建自有活动工具-所有字段
public Response saveHdAll(String id,String creditsType,String title,String limitCount,String limitScope,String freeLimit,String freeScope,String awards,String bannerImgNew) throws Exception {
String url=hdHost+"/launch/save";
Map<String,String> map = new HashMap<>();
map.put("id",id);
map.put("subType","turntable_circle");
map.put("creditsType",creditsType);
map.put("title",title);
map.put("credits","10");
map.put("limitCount",limitCount);
map.put("limitScope",limitScope);
map.put("freeLimit",freeLimit);
map.put("freeScope",freeScope);
map.put("optionNum","");
map.put("anticheatExchangeLimit","true");
map.put("autoOffDate","2030-12-01 00:00");
map.put("banner","//yun.duiba.com.cn/upload/r1u3O1460639179556.png");
map.put("thumbnail","//yun.duiba.com.cn/upload/R8Hac1467009242903.png");
map.put("questionRecord","[]");
map.put("awards",awards);
map.put("appId","2239");
map.put("bannerImgNew",bannerImgNew);
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;
}
//开发者后台编辑自有活动
public Response editData(String actId,String type,String appId) throws Exception {
String url=hdHost+"/launch/editData";
Map<String,String> map = new HashMap<>();
map.put("actId",actId);
map.put("type",type);
map.put("appId",appId);
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