Commit 2b57e8a1 authored by 吕雯燕's avatar 吕雯燕

Merge branch 'duiba_wenyan'

parents da46efca 75037963
......@@ -3,6 +3,7 @@ package http.cases.ClcardTest;
import base.DuibaTestBase;
import http.service.Activity.ClcardService;
import io.restassured.response.Response;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
......@@ -29,18 +30,13 @@ public class 集卡活动领奖_AccessTest extends DuibaTestBase {
@BeforeClass
public void before(){
try {
//修改表,增加用户卡片,"集卡领奖成功"
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +1 , item_total_count = item_total_count +1 WHERE consumer_id = 100164132 AND item_id = 12");
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +2 , item_total_count = item_total_count +2 WHERE consumer_id = 100164132 AND item_id = 13");
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +3 , item_total_count = item_total_count +3 WHERE consumer_id = 100164132 AND item_id = 14");
try{
//修改表,增加用户卡片,"A_集卡单用户并发领奖"
jdbc.update("update collect_card_consumer.tb_collect_card_info_0332 set item_count = item_count +1 , item_total_count = item_total_count +1 WHERE consumer_id = 100168012 AND item_id = 20");
jdbc.update("update collect_card_consumer.tb_collect_card_info_0332 set item_count = item_count +1 , item_total_count = item_total_count +1 WHERE consumer_id = 100168012 AND item_id = 21");
} catch (SQLException e) {
}catch (SQLException e) {
e.printStackTrace();
}
......@@ -50,6 +46,13 @@ public class 集卡活动领奖_AccessTest extends DuibaTestBase {
@Test(description = "集卡活动领奖支付宝测试")
public void 集卡领奖成功() throws Exception{
//修改表,增加用户卡片,"集卡领奖成功"
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +1 , item_total_count = item_total_count +1 WHERE consumer_id = 100164132 AND item_id = 12");
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +2 , item_total_count = item_total_count +2 WHERE consumer_id = 100164132 AND item_id = 13");
jdbc.update("update collect_card_consumer.tb_collect_card_info_0548 set item_count = item_count +3 , item_total_count = item_total_count +3 WHERE consumer_id = 100164132 AND item_id = 14");
Thread.sleep(1000);
int uid = 7402;
String activityId = "45501";
......@@ -81,9 +84,9 @@ public class 集卡活动领奖_AccessTest extends DuibaTestBase {
Assert.assertEquals(response.jsonPath().getString("lottery.title"),"支付宝","校验奖品title失败");
Assert.assertEquals(response.jsonPath().getString("result"),"2","校验result失败");
Assert.assertEquals(cards0,"1","校验card0失败");
Assert.assertEquals(cards0,"0","校验card0失败");
Assert.assertEquals(cards1,"2","校验card1失败");
Assert.assertEquals(cards2,"4","校验card2失败");
Assert.assertEquals(cards2,"1","校验card2失败");
Assert.assertEquals(rules0,"1","校验rules0失败");
Assert.assertEquals(rules1,"2","校验rules1失败");
Assert.assertEquals(rules2,"3","校验rules2失败");
......@@ -141,10 +144,11 @@ public class 集卡活动领奖_AccessTest extends DuibaTestBase {
//同一用户并发领奖 活动:【自动化】集卡发奖3
@Test(threadPoolSize = 5, invocationCount =5)
public void A_集卡单用户并发领奖() throws Exception {
int uid = 7416;
String activityId = "45531";
//领奖(只有一次兑换机会)
//领奖(只有一次机会)
Response response = clcardService.openPrize2(uid,activityId);
resultList.add(response.asString());
logger.info("请求返回结果:" + response.asString());
......@@ -155,18 +159,18 @@ public class 集卡活动领奖_AccessTest extends DuibaTestBase {
int fail = 0;
int success = 0;
for (String s: resultList) {
if(s.contains("desc\":\"服务器开小差了,请稍后重试")){
fail++;
}else if(s.contains("\"desc\":\"OK\"")){
if(s.contains("\"desc\":\"OK\"")){
success++;
}else{
}else if (s.contains("\"success\":false")){
fail++;
}else {
System.out.println(s);
}
}
//检验 成功的只有一个。错误提示有多种
Assert.assertEquals(fail,4,"校验fail数量失败");
Assert.assertEquals(success,1,"校验success数量失败");
logger.info("校验集卡单用户并发成功");
logger.info("校验集卡单用户并发领奖成功");
}
......
......@@ -208,6 +208,7 @@ public class 兑吧老优惠券_兑换流程测试_ExchangeTest extends CheckTem
@Test
public void 优惠券预分配每日限额测试() throws Exception{
int uid = 7447;
//获取当前的时间
Date dNow = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
......
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