Commit 0feab100 authored by 龚小红's avatar 龚小红

优化输出信息

parent 57234657
......@@ -253,5 +253,5 @@ public class Pay implements Authorization {
}
}
}
......@@ -61,6 +61,7 @@ public class OpenLive implements Authorization {
@Test(description = "获取直播配置详情", priority = 2)
public void 获取直播配置详情() {
adminAuth();
Map<String, Object> ConfDetailParam = new HashMap<>();
ConfDetailParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response ConfDetailRes = network.getResponse(ConfDetailParam, BasicConfig.ANCHOR_getConfDetail);
......
......@@ -256,8 +256,8 @@ public class Answer implements Authorization {
params.put("quesConfId", this.quesConfId.get(0).getQuesConfId());
params.put("optionId", this.wronganswer.getId());
Response response = network.postResponse(params, BasicConfig.MOBILE_QuesParticipate);
System.out.println(response.body().asString());
boolean openResult=response.jsonPath().getBoolean("data.openResult");
System.out.println(openResult);
Assert.assertTrue(openResult, network.message(params, BasicConfig.MOBILE_QuesParticipate, "用户参与失败", response.body().asString()));
boolean result=response.jsonPath().getBoolean("data.result");
......@@ -300,7 +300,7 @@ public class Answer implements Authorization {
System.out.println(" 查询用户A领取答题红包结果 timestamp:"+new Date().getTime()+"quesConfId:"+quesConfId);
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
System.out.println(response.body().asString());
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "用户答题结果获取失败", response.body().asString()));
Integer amount = response.jsonPath().getJsonObject("data.amount");
......@@ -479,16 +479,14 @@ public class Answer implements Authorization {
Map<String, Object> params = new HashMap<>();
params.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
params.put("quesConfId",this.quesConfId.get(1).getQuesConfId() );
// params.put("liveId", "Kj21NTI3ODM");
// params.put("quesConfId","Kj21NzY1MTE");
Response response = network.getResponse(params, BasicConfig.MOBILE_QuesParticipateInfo);
boolean result=response.jsonPath().getBoolean("data.result");
System.out.println(result);
System.out.println(response.body().asString());
Assert.assertTrue(result, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
Object amount = response.jsonPath().getJsonObject("data.amount");
System.out.println(amount);
Assert.assertNull(amount,network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "领取失败", response.body().asString()));
Assert.assertNull(amount, network.message(params, BasicConfig.MOBILE_QuesParticipateInfo, "答题失败", response.body().asString()));
}
//*****************有奖答题福利类型*****************//
......
......@@ -19,6 +19,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.utils.ThreadSleepUtils.sleep;
public class SecondKill implements Authorization {
@BeforeClass
......@@ -145,6 +147,7 @@ public class SecondKill implements Authorization {
Map<String, Object> goodsOnPar = new HashMap<>();
goodsOnPar.put("id", ConfSecondKill.skIdFirst);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
System.out.println(goodsOnRes.body().asString());
try {
boolean data = goodsOnRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "上架秒杀失败", goodsOnRes.body().asString()));
......@@ -186,6 +189,7 @@ public class SecondKill implements Authorization {
Map<String, Object> goodsOnPar = new HashMap<>();
goodsOnPar.put("id", ConfSecondKill.skIdThird);
Response goodsOnRes = network.postResponse(goodsOnPar, BasicConfig.ANCHOR_secondKillOn);
System.out.println(goodsOnRes.body().asString());
try {
boolean data = goodsOnRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(goodsOnPar, BasicConfig.ANCHOR_secondKillOn, "上架0元商品秒杀失败", goodsOnRes.body().asString()));
......@@ -199,6 +203,7 @@ public class SecondKill implements Authorization {
@Test(description = "查看当前秒杀商品", priority = 11)
public void 查看当前秒杀商品() {
visitorAuth();
sleep(3000);
Map<String, Object> goodsFirstPar = new HashMap<>();
goodsFirstPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response goodsFirstRes = network.getResponse(goodsFirstPar, BasicConfig.MOBILE_secondKill_goodsFirst);
......@@ -217,6 +222,7 @@ public class SecondKill implements Authorization {
Map<String, Object> downgradeGoodsPar = new HashMap<>();
downgradeGoodsPar.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response downgradeGoodsRes = network.getResponse(downgradeGoodsPar, BasicConfig.MOBILE_secondKill_downgradeGoodsFirst);
System.out.println(downgradeGoodsRes.body().asString());
try {
String confId = downgradeGoodsRes.jsonPath().getString("data.confId");
//校验最新上架的商品
......@@ -258,7 +264,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......@@ -311,7 +317,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......@@ -366,7 +372,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......@@ -410,8 +416,9 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
System.out.println(orderResultRes.body().asString());
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
if (i == 10){
......@@ -577,7 +584,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......@@ -619,7 +626,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......@@ -688,7 +695,7 @@ public class SecondKill implements Authorization {
try {
// 轮训下单接口
while (data == null){
ThreadSleepUtils.sleep(2000);
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
......
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