Commit 27550189 authored by wangxiaoshuang's avatar wangxiaoshuang

wxs

parent 81ff9310
...@@ -45,6 +45,16 @@ public class 秒杀商品_自有新优惠券_兑换限制 extends DuibaTestBase ...@@ -45,6 +45,16 @@ public class 秒杀商品_自有新优惠券_兑换限制 extends DuibaTestBase
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 19 and app_id =22563 and app_item_id=195533"); jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 19 and app_id =22563 and app_item_id=195533");
//商品售罄 //商品售罄
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 20 and app_id =22563 and app_item_id=195534"); jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 20 and app_id =22563 and app_item_id=195534");
//商品永久限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 36 and app_id =22563 and app_item_id=195549");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195549");
//每日兑换限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 37 and app_id =22563 and app_item_id=195550");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195550");
//周期限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 38 and app_id =22563 and app_item_id=195551");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195551");
//永久兑换限制
Thread.sleep(2000); Thread.sleep(2000);
} catch (SQLException e) { } catch (SQLException e) {
...@@ -262,4 +272,170 @@ public class 秒杀商品_自有新优惠券_兑换限制 extends DuibaTestBase ...@@ -262,4 +272,170 @@ public class 秒杀商品_自有新优惠券_兑换限制 extends DuibaTestBase
} }
} }
@Test(description = "优惠券商品永久限制")
public void 优惠券永久限制() throws Exception{
String appItemId="195549";
String itemId=null;
String message = "";
String actId = "36";
String skuId = "136";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
String payCreditsStatus = response.jsonPath().getString("data.payCreditsStatus");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Thread.sleep(1000);
if(status.equals("wait_delivery")){
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
else if(status.equals("success")) {
Assert.assertEquals(status,"success","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
try{
Thread.sleep(1000);
//第二次秒杀
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"已兑换","校验兑换按钮失败");
logger.info("校验秒杀--优惠券活动永久限制");
}
@Test(description = "优惠券商品每日限制")
public void 优惠券每日限制() throws Exception{
String appItemId="195550";
String itemId=null;
String message = "";
String actId = "37";
String skuId = "137";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
String payCreditsStatus = response.jsonPath().getString("data.payCreditsStatus");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
//校验成功
if(status.equals("wait_delivery")){
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
else if(status.equals("success")) {
Assert.assertEquals(status,"success","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
try{
Thread.sleep(1000);
//第二次秒杀
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"今日已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"今日已兑换","校验兑换按钮失败");
logger.info("校验秒杀--优惠券活动每日限制");
}
@Test(description = "优惠券商品周期限制")
public void 优惠券周期限制() throws Exception{
String appItemId="195551";
String itemId=null;
String message = "";
String actId = "38";
String skuId = "138";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
Thread.sleep(1000);
//获取兑换结果
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
String payCreditsStatus = response.jsonPath().getString("data.payCreditsStatus");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
//校验成功
if(status.equals("wait_delivery")){
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
else if(status.equals("success")) {
Assert.assertEquals(status,"success","校验轮询结果status失败");
Assert.assertEquals(payCreditsStatus,"1","校验轮询结果payCreditsStatus失败");
}
Thread.sleep(1000);
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
try{
Thread.sleep(1000);
//第二次秒杀
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
response.prettyPrint();
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"已兑换","校验兑换按钮失败");
logger.info("校验秒杀--优惠券活动周期限制");
}
} }
...@@ -46,6 +46,15 @@ public class 秒杀商品_自有新实物_兑换限制 extends DuibaTestBase { ...@@ -46,6 +46,15 @@ public class 秒杀商品_自有新实物_兑换限制 extends DuibaTestBase {
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 14 and app_id =22563 and app_item_id=195385"); jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 14 and app_id =22563 and app_item_id=195385");
//商品售罄 //商品售罄
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 15 and app_id =22563 and app_item_id=195410"); jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 15 and app_id =22563 and app_item_id=195410");
//每日兑换限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 34 and app_id =22563 and app_item_id=195547");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195547");
//永久兑换限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 33 and app_id =22563 and app_item_id=195546");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195546");
//周期兑换限制
jdbc.update("UPDATE seckill.tb_seckill_act_conf set gmt_start = '"+starttime+"', gmt_end = '"+endtiem+"' WHERE id = 35 and app_id =22563 and app_item_id=195548");
jdbc.update("DELETE FROM credits_dev.consumer_limit_record where app_item_id =195548");
Thread.sleep(2000); Thread.sleep(2000);
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
...@@ -256,4 +265,136 @@ public class 秒杀商品_自有新实物_兑换限制 extends DuibaTestBase { ...@@ -256,4 +265,136 @@ public class 秒杀商品_自有新实物_兑换限制 extends DuibaTestBase {
} }
} }
@Test(description = "实物商品永久限制")
public void 实物永久限制() throws Exception{
String appItemId="195546";
String itemId=null;
String message = "";
String actId = "33";
String skuId = "132";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Thread.sleep(1000);
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
try{
Thread.sleep(1000);
//第二次秒杀
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"已兑换","校验兑换按钮失败");
logger.info("校验秒杀--实物活动永久限制");
}
@Test(description = "实物商品每日限制")
public void 实物每日限制() throws Exception{
String appItemId="195547";
String itemId=null;
String message = "";
String actId = "34";
String skuId = "134";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Thread.sleep(1000);
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
Thread.sleep(1000);
try{
//第二次秒杀兑换
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"今日已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"今日已兑换","校验兑换按钮失败");
logger.info("校验秒杀--每日限制");
}
@Test(description = "实物商品周期限制")
public void 实物周期限制() throws Exception{
String appItemId="195548";
String itemId=null;
String message = "";
String actId = "35";
String skuId = "135";
String pageId = "63";
//第一次秒杀
Response response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
String orderId = response.jsonPath().getString("data.orderId");
//获取兑换结果
response = seckillNewService.orderStatus(orderId,uid);
String status = response.jsonPath().getString("data.status");
int i = 10;
//异步接口,直到兑换成功
while (i> 0 && status.equals("processing")) {
Thread.sleep(1000);
response = seckillNewService.orderStatus(orderId,uid);
status = response.jsonPath().getString("data.status");
i--;
}
Assert.assertEquals(status,"wait_delivery","校验轮询结果status失败");
Thread.sleep(1000);
//查询商品详情页按钮
Response detailResponse = seckillNewService.queryBtnStatus(appItemId,actId,pageId,uid);
String exchangeText = detailResponse.jsonPath().getString("data.seckillBtnVO.exchangeBtnVO.exchangeText");
logger.info("商品兑换按钮:" + exchangeText);
try{
Thread.sleep(1000);
//秒杀兑换
response = seckillNewService.exchange(itemId,appItemId,uid,skuId,actId);
}catch (Exception e){
message = e.toString();
}
String msg = response.jsonPath().getString("msg");
Assert.assertEquals(msg,"已兑换","校验兑换按钮失败");
Assert.assertEquals(exchangeText,"已兑换","校验兑换按钮失败");
logger.info("校验秒杀--周期限制");
}
} }
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