Commit 75927390 authored by 赵然's avatar 赵然

zr

parent af5a2eb2
......@@ -156,7 +156,7 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
break;
}
Thread.sleep(1000);
}
......@@ -249,18 +249,18 @@ public class CustomActivity_DuibaTest extends DuibaTestBase {
//活动抽奖接口传参单独抽离
public Response 自定义答题活动抽奖(String activityId, String token, String device) throws Exception {
Response response = newActivityService.doJoin2(activityId, token);
Response response = newActivityService.doJoin2(7496,activityId, token);
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
newActivityService.submit(orderId);
newActivityService.submit(7496,orderId);
Thread.sleep(1000);
response = newActivityService.getOrderStatus2(orderId, device);
response = newActivityService.getOrderStatus2(7496,orderId, device);
String result = String.valueOf(response.jsonPath().getString("result"));
int i = 8;
while (i > 0 && (result.equals("0"))) {
Thread.sleep(1000);
response = newActivityService.getOrderStatus2(orderId, device);
response = newActivityService.getOrderStatus2(7496,orderId, device);
result = String.valueOf(response.jsonPath().getString("result"));
i--;
response.prettyPrint();
......
......@@ -106,17 +106,17 @@ public class 优惠券测试_DuibaTest extends AbstractTestNGSpringContextTests
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
Response response = newActivityService.doJoin2(activityId,token);
Response response = newActivityService.doJoin2(7497,activityId,token);
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
response = newActivityService.getOrderStatus2(orderId,device);
response = newActivityService.getOrderStatus2(7497,orderId,device);
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(7497,orderId,device);
result = String.valueOf(response.jsonPath().getString("result"));
i--;
response.prettyPrint();
......
......@@ -27,7 +27,7 @@ public class 全局红包账户_DuibaTest extends DuibaTestBase {
@Test
public void 全局红包测试() throws Exception {
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0687 where account_id = '100025007_0_0' ");
Map<String, Object> selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0176 where account_id = '100176048_0_0' ");
int balance = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("账户原有余额为"+balance);
//进行接口测试传参
......@@ -40,7 +40,7 @@ public class 全局红包账户_DuibaTest extends DuibaTestBase {
balance = balance + bonus;
logger.info("预期余额为"+balance);
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0687 where account_id = '100025007_0_0' ");
selectResult = jdbc.findSimpleResult("select * from consumer_accounts.tb_consumer_account_0176 where account_id = '100176048_0_0' ");
int balanceNew = Integer.parseInt(String.valueOf(selectResult.get("balance_amount")));
logger.info("实际余额为"+balanceNew);
Assert.assertEquals(balanceNew,balance,"全局红包增加账户余额失败");
......@@ -48,17 +48,17 @@ public class 全局红包账户_DuibaTest extends DuibaTestBase {
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
Response response = newActivityService.doJoin2(activityId,token);
Response response = newActivityService.doJoin2(7498 ,activityId,token);
response.prettyPrint();
String orderId = response.jsonPath().getString("orderId");
response = newActivityService.getOrderStatus2(orderId,device);
response = newActivityService.getOrderStatus2(7498,orderId,device);
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(7498,orderId,device);
result = String.valueOf(response.jsonPath().getString("result"));
i--;
response.prettyPrint();
......
......@@ -59,12 +59,12 @@ public class 奖品发放限制_DuibaTest extends DuibaTestBase {
public void 奖品发放限制测试_永久() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35868","adsdas","iOS");
Response response = this.新活动工具接口传参(7499,"35868","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参("35868","adsdas","iOS");
response = this.新活动工具接口传参(7499,"35868","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第一次抽奖出奖文案失败");
......@@ -75,30 +75,30 @@ public class 奖品发放限制_DuibaTest extends DuibaTestBase {
public void 奖品发放限制测试_每日() throws Exception {
//第一次抽奖
Response response = this.新活动工具接口传参("35920","adsdas","iOS");
Response response = this.新活动工具接口传参(7500,"35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"phonebill","第一次抽奖出奖类型失败,请考虑是否activity-access-web发布了master分支所导致");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.title")),"话费","第一次抽奖出奖title失败");
//第二次抽奖
response = this.新活动工具接口传参("35920","adsdas","iOS");
response = this.新活动工具接口传参(7500,"35920","adsdas","iOS");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.type")),"lucky","第一次抽奖出奖类型失败");
Assert.assertEquals( String.valueOf(response.jsonPath().getString("lottery.useBtnText")),"马上使用","第一次抽奖出奖文案失败");
}
public Response 新活动工具接口传参(String activityId,String token,String device) throws Exception {
Response response = newActivityService.doJoin2(activityId,token);
public Response 新活动工具接口传参(int uid,String activityId,String token,String device) 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,device);
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,device);
result = String.valueOf(response.jsonPath().getString("result"));
i--;
response.prettyPrint();
......
......@@ -331,6 +331,31 @@ public class NewActivityService {
return response;
}
public Response getOrderStatus2(int uid,String orderId,String device) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
Map<String,String> maphead = new HashMap<>();
if ( device.equals("iOS")) {
maphead.put("User-Agent", "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) CriOS/56.0.2924.75 Mobile/14E5239e Safari/602.1");
}else{
maphead.put("User-Agent", "Mozilla/5.0 (Linux; Android 5.0; SM-G900P Build/LRX21T) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.108 Mobile Safari/537.36");
}
logger.info("请求/hdtool/getOrderStatus接口,orderId="+orderId);
Response response = given().headers(maphead).cookies(authorization.dafuwengLogin(uid)).params(map).post(url+"/hdtool/getOrderStatus");
try{
Assert.assertEquals(response.jsonPath().getString("success"),"true");
}catch(Exception e){
throw new Exception("/hdtool/getOrderStatus接口失败,返回信息:"+response.asString());
}catch(Error er){
throw new Exception("/hdtool/getOrderStatus接口失败,返回信息:"+response.asString());
}
return response;
}
public Response getOrderStatus3(String orderId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
......@@ -515,12 +540,12 @@ public class NewActivityService {
return response;
}
//自定义答题活动--提交答案
public void submit(String orderId) throws Exception {
public void submit(int uid,String orderId) throws Exception {
Map<String,String> map = new HashMap<>();
map.put("orderId",orderId);
map.put("answerData","[{\"id\":465,\"option\":3}]");
logger.info("请求/hdtool/submit接口,orderId="+orderId);
Response response = given().cookies(authorization.dafuwengLogin(2720)).params(map).post(url+"/hdtool/submit");
Response response = given().cookies(authorization.dafuwengLogin(uid)).params(map).post(url+"/hdtool/submit");
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