Commit 59b9071f authored by 龚小红's avatar 龚小红

fix---修复优惠券商品秒杀id错误

parent 8b83730b
...@@ -19,7 +19,7 @@ import static com.kjj.cases.live.anchor.CloseLive.closeLive; ...@@ -19,7 +19,7 @@ import static com.kjj.cases.live.anchor.CloseLive.closeLive;
import static com.kjj.cases.live.anchor.OpenLive.openLive; import static com.kjj.cases.live.anchor.OpenLive.openLive;
import static com.kjj.cases.live.liveConfig.LiveBinding.binding; import static com.kjj.cases.live.liveConfig.LiveBinding.binding;
import static com.kjj.cases.live.liveConfig.LiveBinding.share; import static com.kjj.cases.live.liveConfig.LiveBinding.share;
import static com.kjj.cases.live.secondKill.SecondKill.killOn; import static com.kjj.cases.live.secondKill.SecondKill.*;
import static com.kjj.config.BasicConfig.*; import static com.kjj.config.BasicConfig.*;
import static com.kjj.config.BasicConfig.USER_clueInfoData; import static com.kjj.config.BasicConfig.USER_clueInfoData;
import static com.kjj.utils.BaseUtils.connectSuccess; import static com.kjj.utils.BaseUtils.connectSuccess;
...@@ -347,50 +347,15 @@ public class Voucher implements Authorization { ...@@ -347,50 +347,15 @@ public class Voucher implements Authorization {
} }
} }
@Test(description = "客户A使用代金券下单价格大于代金券的商品", priority = 22) @Test(description = "客户A使用代金券下单价格大于价格的商品", priority = 22)
public void 客户A使用代金券下单价格大于代金券的商品() { public void 客户A使用代金券下单价格大于代金券的商品() {
visitorAuth3(); visitorAuth3();
Map<String, Object> orderPar = new HashMap<>(); order(VoucherConf.skIdFirst,"",voucherId);
orderPar.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", VoucherConf.skIdFirst);
orderPar.put("voucherId",voucherId);
orderPar.put("couponsId","");
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "下单失败", orderRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "未获取到数据", orderRes.body().asString()));
}
} }
@Test(description = "客户A获取下单结果", priority = 23) @Test(description = "客户A获取下单结果", priority = 23)
public void 客户A获取下单结果() { public void 客户A获取下单结果() {
Map<String, Object> orderResultPar = new HashMap<>(); orderResult(VoucherConf.skIdFirst,2);
orderResultPar.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", VoucherConf.skIdFirst);
Response orderResultRes = null;
Object data = null;
int i = 0;
try {
// 轮训下单接口
while (data == null){
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
if (i == 10){
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训下单结果超过10次", orderResultRes.body().asString()));
}
}
int state = orderResultRes.jsonPath().getInt("data.state");
Assert.assertEquals(state, 4, network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "下单未成功", orderResultRes.body().asString()));
System.out.println(data);
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", orderResultRes.body().asString()));
}
} }
@Test(description = "客户A用户代金券列表更新",priority = 24) @Test(description = "客户A用户代金券列表更新",priority = 24)
...@@ -441,50 +406,15 @@ public class Voucher implements Authorization { ...@@ -441,50 +406,15 @@ public class Voucher implements Authorization {
Assert.assertTrue(data,network.message(params,BasicConfig.MOBILE_acceptGift, "代理人赠送代金券未开启", response.body().asString())); Assert.assertTrue(data,network.message(params,BasicConfig.MOBILE_acceptGift, "代理人赠送代金券未开启", response.body().asString()));
} }
@Test(description = "客户B使用代金券下单价格小于代金券的商品", priority = 28) @Test(description = "客户B使用代金券下单价格小于价格的商品", priority = 28)
public void 客户B使用代金券下单价格小于代金券的商品() { public void 客户B使用代金券下单价格小于价格的商品() {
visitorAuth2(); visitorAuth2();
Map<String, Object> orderPar = new HashMap<>(); order(VoucherConf.skIdSecond,"",voucherId);
orderPar.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderPar.put("confId", VoucherConf.skIdSecond);
orderPar.put("voucherId",voucherId);
orderPar.put("couponsId","");
Response orderRes = network.postResponse(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder);
try {
boolean data = orderRes.jsonPath().getBoolean("data");
Assert.assertTrue(data, network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "下单失败", orderRes.body().asString()));
}catch (NullPointerException e){
e.printStackTrace();
Assert.fail(network.message(orderPar, BasicConfig.MOBILE_secondKill_goodsOrder, "未获取到数据", orderRes.body().asString()));
}
} }
@Test(description = "客户B获取下单结果", priority = 29) @Test(description = "客户B获取下单结果", priority = 29)
public void 客户B获取下单结果() { public void 客户B获取下单结果() {
Map<String, Object> orderResultPar = new HashMap<>(); orderResult(VoucherConf.skIdSecond,1);
orderResultPar.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
orderResultPar.put("confId", VoucherConf.skIdSecond);
Response orderResultRes = null;
Object data = null;
int i = 0;
try {
// 轮训下单接口
while (data == null){
sleep(2000);
orderResultRes = network.getResponse(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult);
data = orderResultRes.jsonPath().getJsonObject("data");
i++;
if (i == 10){
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "轮训下单结果超过10次", orderResultRes.body().asString()));
}
}
int state = orderResultRes.jsonPath().getInt("data.state");
Assert.assertEquals(state, 3, network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "下单未成功", orderResultRes.body().asString()));
System.out.println(data);
}catch (Exception e){
e.printStackTrace();
Assert.fail(network.message(orderResultPar, BasicConfig.MOBILE_secondKill_goodsOrderResult, "获取数据失败", orderResultRes.body().asString()));
}
} }
@Test(description = "管理后台查看用户代金券秒杀订单",priority = 30) @Test(description = "管理后台查看用户代金券秒杀订单",priority = 30)
......
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