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

lv

parent de293b05
...@@ -50,7 +50,15 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{ ...@@ -50,7 +50,15 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有独立活动工具--永久次数"}, //case2 ,"//yun.dui88.com/images/201811/2yyblucaps.jpg","新建自有独立活动工具--永久次数"}, //case2
}; };
} }else
if(method.getName().equals("新建自有单品抽奖活动")){
result = new Object[][]{
new Object[]{1,"177222","【自动化】自有实物","object","100","5","everyday","//yun.dui88.com/images/201811/hvhlu2ggta.png","0","","新建自有单品抽奖--每天抽奖"}, //case1
};
}
return result; return result;
} }
...@@ -110,7 +118,6 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{ ...@@ -110,7 +118,6 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
} }
@Test(dataProvider = "providerMethod" ) @Test(dataProvider = "providerMethod" )
public void 新建自有独立活动工具(int caseNum,String limitCount,String limitScope,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception { public void 新建自有独立活动工具(int caseNum,String limitCount,String limitScope,String freeScope,String awards,String bannerImgNew,String caseName) throws Exception {
logger.info("-----------------------------"+caseName+"-----------------------------"); logger.info("-----------------------------"+caseName+"-----------------------------");
...@@ -151,6 +158,60 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{ ...@@ -151,6 +158,60 @@ public class 新建活动测试_DuibaTest extends DuibaTestBase{
} }
/**
* @param caseNum 用例编号
* @param mainAppItemId 活动奖品id
* @param appItemTitle 活动奖品名称
* @param appItemType 活动奖品类型
* @param mainAppItemRemaining 奖品数量
* @param freeDrawLimit 免费抽奖次数
* @param freeDrawLimitScope 免费抽奖类型
* @param bannerImgNew 新版banner图
* @param vipLimitType 会员等级配置
* @param vipLimits 会员的等级范围
* @param caseName 用例名称
* @throws Exception
*/
@Test(dataProvider = "providerMethod")
public void 新建自有单品抽奖活动(int caseNum,String mainAppItemId,String appItemTitle,String appItemType,String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits,String caseName) throws Exception{
logger.info("-----------------------------"+caseName+"-----------------------------");
String data = PublicMethod.data();
String title = "【自动化】自有单品抽奖"+data;
//新建自有活动工具
developerService.saveDpAll("",title,mainAppItemId,appItemTitle,appItemType,mainAppItemRemaining,freeDrawLimit,freeDrawLimitScope,bannerImgNew,vipLimitType,vipLimits);
//获取活动id
Response listResponse = developerService.list2(title);
String id = String.valueOf(listResponse.jsonPath().getString("data.list[0].activityId"));
//编辑活动,校验活动内容
Response editResponse = developerService.editDetail("2239",id);
switch (caseNum){
case 1:
Assert.assertEquals(editResponse.jsonPath().getString("data.appItemTitle"),"【自动化】自有实物","校验活动奖品名称失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.bannerImgNew"),"//yun.dui88.com/images/201811/hvhlu2ggta.png","校验活动新版banner图失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimit"),"5","校验活动免费抽奖次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.freeDrawLimitScope"),"everyday","校验活动免费抽奖类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimit"),"2","校验用户抽奖限制次数失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.consumerDrawLimitScope"),"everyday","校验用户抽奖限制类型失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemId"),"177222","校验活动奖品id失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.mainAppItemRemaining"),"100","校验活动奖品数量失败");
Assert.assertEquals(editResponse.jsonPath().getString("data.limitDateJson"),"{\"endDay\":\"2020-02-01\",\"endThours\":\"22\",\"endTminute\":\"0\",\"startDay\":\"2018-11-26\",\"startHours\":\"6\",\"startTminute\":\"0\"}","校验活动抽奖日期限制失败");
logger.info("校验新建自有单品抽奖-1内容成功");
break;
}
//删除测试数据
this.删除自有活动(title);
}
//删除自有活动 //删除自有活动
public void 删除自有活动(String title) throws Exception{ public void 删除自有活动(String title) throws Exception{
//开发者删除自有活动 //开发者删除自有活动
......
package http.service.hd; package http.service.hd;
import cn.com.duiba.activity.center.api.params.MainmeetActivityParams;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import http.service.Authorization; import http.service.Authorization;
import base.DuibaLog; import base.DuibaLog;
...@@ -15,6 +16,7 @@ import java.util.List; ...@@ -15,6 +16,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import static io.restassured.RestAssured.given; import static io.restassured.RestAssured.given;
import static io.restassured.RestAssured.post;
@Service @Service
public class DeveloperService { public class DeveloperService {
...@@ -974,5 +976,82 @@ public class DeveloperService { ...@@ -974,5 +976,82 @@ public class DeveloperService {
return response; return response;
} }
//创建保存自有单品抽奖
public Response saveDpAll(String id,String title,String mainAppItemId,String appItemTitle,String appItemType, String mainAppItemRemaining,String freeDrawLimit,String freeDrawLimitScope,String bannerImgNew,String vipLimitType,String vipLimits) throws Exception {
String url=hdHost+"/appSingleLottery/saveOrUpdate";
Map<String,String> map = new HashMap<>();
map.put("appId","2239");
map.put("id",id);
map.put("appItemTitle",appItemTitle);
map.put("title",title);
map.put("mainAppItemRemaining",mainAppItemRemaining);
map.put("preMainAppItemRemaining","0");
map.put("credits","50");
map.put("mainAppItemRate","66.66");
map.put("minComein","100");
map.put("autoOffDate","2020-11-01 00:00");
map.put("introduction","自动化测试单品抽奖 奖品说明");
map.put("vipLimitType",vipLimitType);
map.put("vipLimits",vipLimits);
map.put("moreExchangeLimit","true");
map.put("freeDrawLimit",freeDrawLimit);
map.put("freeDrawLimitScope",freeDrawLimitScope);
map.put("consumerDrawLimit","2");
map.put("consumerDrawLimitScope","everyday");
map.put("consumerWinLimit","1");
map.put("everydayWinLimit","10");
map.put("startDay","2018-11-26");
map.put("endDay","2020-02-01");
map.put("startHours","6");
map.put("startTminute","0");
map.put("endThours","22");
map.put("endTminute","0");
map.put("exchangeLimit","false");
map.put("appItemType",appItemType);
map.put("mainAppItemId",mainAppItemId);
map.put("mainAppItemDegree","");
map.put("appItemId",mainAppItemId);
map.put("logo","//yun.dui88.com/images/201610/dczuwpckbw.png");
map.put("smallImage","//yun.dui88.com/images/201610/2tvxvbhj3x.jpg");
map.put("image","//yun.dui88.com/images/201610/sk21di3uia.jpg");
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 editDetail(String appId,String singleLotteryId) throws Exception {
String url=hdHost+"/appSingleLottery/editDetail";
Map<String,String> map = new HashMap<>();
map.put("appId",appId);
map.put("singleLotteryId",singleLotteryId);
logger.info("请求编辑自有单品抽奖活动url:"+url);
Response response=given().contentType("application/x-www-form-urlencoded;charset=UTF-8").cookies(authorization.hdLogin()).params(map).get("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