Commit a1b3edd9 authored by 赵然's avatar 赵然

zr

parent a78a1cd1
......@@ -26,11 +26,12 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
ActivityService activityService;
private static DuibaLog logger = DuibaLog.getLogger();
private static int uid = 4259;
@Test
public void 福袋商品测试() throws Exception {
logger.info("-------------------------------------活动中奖福袋商品-------------------------------------");
Response response = this.新活动工具接口传参("18567","1gffs6mq3","iOS");
Response response = this.新活动工具接口传参(uid,"18567","1gffs6mq3");
//String type = String.valueOf(response.jsonPath().getString("lottery.type"));
//推啊出券系统检测
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
......@@ -53,7 +54,7 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public void 谢谢参与转福袋测试() throws Exception {
logger.info("-------------------------------------活动中奖谢谢参与转福袋-------------------------------------");
Response response = this.新活动工具接口传参("26640","1gffs6mq3","iOS");
Response response = this.新活动工具接口传参(uid,"26640","1gffs6mq3");
//String type = String.valueOf(response.jsonPath().getString("lottery.type"));
//推啊出券系统检测
// if(activityService.isRunning("10.110.10.12","17791","tuia-engine")){
......@@ -75,14 +76,14 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public void 免费次数测试() throws Exception {
Response response1 = newActivityService.ajaxElement("3251","19114");
Response response1 = newActivityService.ajaxElement(uid,"3251","19114");
String freeLimit = String.valueOf(response1.jsonPath().getString("element.freeLimit"));
logger.info("抽奖前剩余免费抽奖次数:"+freeLimit);
freeLimit = String.valueOf(Integer.valueOf(freeLimit)-1);
Response response = this.新活动工具接口传参("19114","ogw24k6ns","iOS");
Response response = this.新活动工具接口传参(uid,"19114","ogw24k6ns");
Thread.sleep(1000);
Response response2 = newActivityService.ajaxElement("3251","19114");
Response response2 = newActivityService.ajaxElement(uid,"3251","19114");
String freeLimitNew = String.valueOf(response2.jsonPath().getString("element.freeLimit"));
logger.info("抽奖后剩余免费抽奖次数:"+freeLimitNew);
......@@ -94,14 +95,14 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
@Test
public void 再抽一次测试() throws Exception {
//查询数据库,当前积分(抽奖扣积分流程校验)
Map<String,Object> mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id=2720");
Map<String,Object> mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid);
String credits = String.valueOf(mapuser.get("credits"));
logger.info("抽奖前积分:"+credits);
//扣去1积分
credits = String.valueOf(Integer.valueOf(credits)-1);
//第一次抽奖
Response response = this.新活动工具接口传参("18580","m8rhchc","iOS");
Response response = this.新活动工具接口传参(uid,"18580","m8rhchc");
Assert.assertEquals(response.jsonPath().getString("lottery.type"),"again","校验type失败");
Assert.assertEquals(response.jsonPath().getString("lottery.id"), "11608", "校验id失败");
......@@ -109,7 +110,7 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger.info("校验:type,id,result成功");
//第一次抽奖后查询数据库,获取当前积分
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id=2720");
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid);
String creditsNew = String.valueOf(mapuser.get("credits"));
logger.info("第一次抽奖后积分:"+creditsNew);
//校验比较,抽奖前后积分
......@@ -117,11 +118,11 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger.info("校验第一次抽奖前后积分正确");
//第二次抽奖
response = newActivityService.doJoin2("18580","m8rhchc",response.jsonPath().getString("againTag"));
response = newActivityService.doJoin2(uid,"18580","m8rhchc",response.jsonPath().getString("againTag"));
response.prettyPrint();
Thread.sleep(2000);
//第二次抽奖后查询数据库,获取当前积分
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id=2720");
mapuser = jdbc.findSimpleResult("select * from dafuweng.user where id="+uid);
String creditsNew2 = String.valueOf(mapuser.get("credits"));
logger.info("第二次抽奖后积分:"+creditsNew2);
//校验比较,抽奖前后积分
......@@ -129,18 +130,18 @@ public class 新活动工具测试_DuibaTest extends DuibaTestBase {
logger.info("校验第二次抽奖前后积分正确");
}
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
Response response = newActivityService.doJoin2(activityId,token);
public Response 新活动工具接口传参(int uid,String activityId,String token) throws Exception {
Response response = newActivityService.doJoin2(uid,activityId,token);
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
response = newActivityService.getOrderStatus2(orderId,device);
response = newActivityService.getOrderStatus2(uid,orderId);
response.prettyPrint();
String result = String.valueOf(response.jsonPath().getString("result"));
int i= 30;
while(i>0&&(result.equals("0"))){
Thread.sleep(1000);
response = newActivityService.getOrderStatus2(orderId,device);
response = newActivityService.getOrderStatus2(uid,orderId);
result = String.valueOf(response.jsonPath().getString("result"));
i--;
response.prettyPrint();
......
......@@ -113,13 +113,13 @@ public class NewActivityService {
return response;
}
public Response doJoin2( String activityId,String token,String orderId) throws Exception{
public Response doJoin2( int uid,String activityId,String token,String orderId) throws Exception{
Map<String,String> map = new HashMap<>();
map.put("activityId",activityId);
map.put("token",token);
map.put("againOrderId",orderId);
logger.info("请求/hdtool/doJoin接口,activityId="+activityId);
Response response = given().cookies(authorization.dafuwengLogin(2720)).params(map).post(url+"/hdtool/doJoin");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(url+"/hdtool/doJoin");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
......
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