Commit 3830d172 authored by 周松波's avatar 周松波

update

parent d6af2220
......@@ -111,6 +111,16 @@ public class ContractSignCommon extends DuibaTestBase{
}
}
public void clearRecordByIssueId(String issueId, MysqlConnPool jdbc){
try{
jdbc.update("update credits_sign.tb_sign_contract_bet set done_days=0, done_status=1 where issue_id="+ issueId);
jdbc.update("delete from credits_sign.tb_sign_contract_log where issue_id=" + issueId);
}catch (SQLException e){
logger.info("数据库更新异常");
}
}
public void modifyIssuePeriod(String issueId, int num) throws Exception{
String sql = "select start_time,end_time from credits_sign.tb_sign_contract_issue where id=" + issueId;
Map<String, Object> result = jdbc.findSimpleResult(sql);
......
package http.cases.SignTest;
import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ContractSign_CashCheating_signTest extends DuibaTestBase {
@Autowired
ContractSignCommon ContractSignCommon;
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
http.service.Activity.ContractSignService ContractSignService;
@Autowired
ManagerService managerService;
@Value("${activity.host}")
String activityHost;
private static int uid1,uid2,uid3,uid4,uid5;
static {
uid1 = 4897; //100109143
uid2 = 4898;
uid3 = 4899;
uid4 = 4900;
uid5 = 4901;
}
private static String actId = "8";
private String issueId;
private String period, period_tomorrow, period_today;
private String contractId1,contractId2,contractId3,contractId4,contractId5;
@BeforeClass
public void beforeclass() {
ContractSignCommon.clearIssue("100109143",actId,jdbc);
}
@Test(description = "瓜分现金作弊模式报名,周期7天")
public void 瓜分现金作弊模式报名() throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date();
period_today = format2.format(date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
String startTime = format.format(calendar.getTime());
period_tomorrow = format2.format(calendar.getTime());
calendar.add(Calendar.DAY_OF_YEAR, -8);
period = format2.format(calendar.getTime());
Map<String, String> map = new HashMap<>();
String doneStatus;
//10个用户报名
for (int uid = uid1; uid <= uid5; uid++) {
map = ContractSignCommon.doJoinResult(actId, "100", uid);
doneStatus = map.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING",uid+"报名失败:" + doneStatus);
}
issueId = map.get("issueId");
logger.info("issueId为:" + issueId);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
//homeInfoRes.prettyPrint();
String betTotalCount = homeInfoRes.jsonPath().getString("data.betTotalCount");
Assert.assertEquals(betTotalCount, "100000", "报名后奖池金额不正确");
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,"100", "报名的额度不正确");
int buyers_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.buyers"));
Assert.assertEquals(buyers_new, 15,"报名后人数不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "参与期次号不正确");
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod, "0", "当前期次进度不正确");
//0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期)
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确");
int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount"));
Assert.assertEquals(totalCount_new, 100000, "报名后奖池数量不正确");
}
@Test(description = "瓜分现金作弊打卡" ,priority = 2,dependsOnMethods = { "瓜分现金作弊模式报名" })
public void 瓜分现金作弊打卡() throws Exception {
ContractSignCommon.modifyIssuePeriod(issueId,-1);
ContractSignService.getHomeInfo(actId, uid1);
//Thread.sleep(60000);
//uid1,uid2,uid3 打卡
Response doSignRes = ContractSignService.doSign(actId, uid1);
String success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid1打卡失败");
doSignRes = ContractSignService.doSign(actId, uid2);
success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2打卡失败");
doSignRes = ContractSignService.doSign(actId, uid3);
success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid3打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
Assert.assertEquals(daySuccCount, "9", "打卡后,打卡成功人数不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
Response recordRes = ContractSignService.getContracts(actId, uid1);
contractId1 = recordRes.jsonPath().getString("data.list[0].contractId");
}
@Test(description = "瓜分现金作弊整期完成" ,priority = 3,dependsOnMethods = { "瓜分现金作弊打卡" })
public void 瓜分现金作弊整期完成() throws Exception{
ContractSignCommon.modifyIssuePeriod(issueId, -6);
ContractSignCommon.clearRecordByIssueId(issueId,jdbc);
for(int uid=uid1;uid<=uid3;uid++){
ContractSignCommon.contractResign(actId,uid,7,false);
}
//修改期次后有1分钟缓存
ContractSignService.getHomeInfo(actId, uid1);
Thread.sleep(60000);
//uid1 打卡
Response signRes = ContractSignService.doSign(actId, uid1);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid1第7日打卡失败");
//uid2 7日打卡完成
signRes = ContractSignService.doSign(actId, uid2);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2第7日打卡失败");
//uid3 7日打卡完成
signRes = ContractSignService.doSign(actId, uid3);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid3第7日打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid1是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid1明日是否有奖励状态不正确");
Response recordRes = ContractSignService.getContracts(actId, uid1);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid1参与记录中完成状态不正确");
}
@Test(description = "瓜分现金作弊开奖, 活动ID=7" ,priority = 4,dependsOnMethods = { "瓜分现金作弊整期完成" })
public void 瓜分现金作弊开奖() throws Exception{
//修改期次,今日开奖
ContractSignCommon.modifyIssuePeriod(issueId, -1);
//修改期次后有1分钟缓存
ContractSignService.getHomeInfo(actId, uid1);
Thread.sleep(60000);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
//homeInfoRes.prettyPrint();
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
//查询待领取奖励
Response recordRes = ContractSignService.getContracts(actId, uid1);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "11111", "瓜分奖励金额不正确");
//领奖
Response rewardRes = ContractSignService.getReward(contractId1,uid1);
String rewardStatus = rewardRes.jsonPath().getString("success");
String rewardAmount = rewardRes.jsonPath().getString("data");
Assert.assertEquals(rewardStatus,"true","领取奖励结果不正确");
Assert.assertEquals(rewardAmount,winCount,"领取奖励金额不正确");
}
}
......@@ -4,9 +4,18 @@ import base.DuibaTestBase;
import http.service.Activity.ManagerService;
import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
public class ContractSign_Cash_signTest extends DuibaTestBase {
@Autowired
......@@ -23,11 +32,6 @@ public class ContractSign_Cash_signTest extends DuibaTestBase {
String activityHost;
private static int uid1,uid2,uid3,uid4,uid5;
static {
// uid1 = 4897; //100109143
// uid2 = 4888;
// uid3 = 4889;
// uid4 = 4900;
// uid5 = 4901;
uid1 = 4902; //100109140
uid2 = 4903;
uid3 = 4904;
......@@ -44,5 +48,138 @@ public class ContractSign_Cash_signTest extends DuibaTestBase {
}
@Test(description = "瓜分现金模式报名,周期7天")
public void 瓜分现金模式报名() throws Exception{
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat format2 = new SimpleDateFormat("MMdd");
Date date = new Date();
period_today = format2.format(date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.add(Calendar.DAY_OF_YEAR, 1);
String startTime = format.format(calendar.getTime());
period_tomorrow = format2.format(calendar.getTime());
calendar.add(Calendar.DAY_OF_YEAR, -8);
period = format2.format(calendar.getTime());
Map<String, String> map = new HashMap<>();
String doneStatus;
//10个用户报名
for (int uid = uid1; uid <= uid5; uid++) {
map = ContractSignCommon.doJoinResult(actId, "0", uid);
doneStatus = map.get("doneStatus");
Assert.assertEquals(doneStatus,"DOING",uid+"报名失败:" + doneStatus);
}
issueId = map.get("issueId");
logger.info("issueId为:" + issueId);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
//homeInfoRes.prettyPrint();
String bankerBonus = homeInfoRes.jsonPath().getString("data.bankerBonus");
Assert.assertEquals(bankerBonus, "100000", "报名奖池金额不正确");
String betCount = homeInfoRes.jsonPath().getString("data.betCount");
Assert.assertEquals(betCount,"0", "报名的额度不正确");
int buyers_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.buyers"));
Assert.assertEquals(buyers_new, 5,"报名人数未增加");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "参与期次号不正确");
String currentPeriod = homeInfoRes.jsonPath().getString("data.currentPeriod");
Assert.assertEquals(currentPeriod, "0", "当前期次进度不正确");
//0-未报名 1-报名中 2-已报名,打卡未开始 3-未打卡:打卡开始,当天未打卡 4-已打卡:当天已打卡(非最后一天) 5-失败:出现断卡(未报名新一期) 6-成功: 已成功(未报名新一期)
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "2", "当前参与状态不正确");
int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount"));
Assert.assertEquals(totalCount_new, 100000, "报名后奖池数量不正确");
}
@Test(description = "瓜分积分作弊打卡, 活动ID=7" ,priority = 2,dependsOnMethods = { "瓜分现金模式报名" })
public void 瓜分现金模式打卡() throws Exception {
ContractSignCommon.modifyIssuePeriod(issueId,-1);
ContractSignService.getHomeInfo(actId, uid1);
//Thread.sleep(60000);
//uid1,uid2,uid3 打卡
Response doSignRes = ContractSignService.doSign(actId, uid1);
String success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid1打卡失败");
doSignRes = ContractSignService.doSign(actId, uid2);
success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2打卡失败");
doSignRes = ContractSignService.doSign(actId, uid3);
success = doSignRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid3打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
String daySuccCount = homeInfoRes.jsonPath().getString("data.daySuccCount");
//Assert.assertEquals(daySuccCount, "3", "打卡后,打卡成功人数不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "4", "打卡完成后状态不正确");
Response recordRes = ContractSignService.getContracts(actId, uid1);
contractId1 = recordRes.jsonPath().getString("data.list[0].contractId");
}
@Test(description = "瓜分现金整期完成, 活动ID=7" ,priority = 3,dependsOnMethods = { "瓜分现金模式打卡" })
public void 瓜分现金整期完成() throws Exception{
ContractSignCommon.modifyIssuePeriod(issueId, -6);
ContractSignCommon.clearRecordByIssueId(issueId,jdbc);
for(int uid=uid1;uid<=uid3;uid++){
ContractSignCommon.contractResign(actId,uid,7,false);
}
//修改期次后有1分钟缓存
ContractSignService.getHomeInfo(actId, uid1);
Thread.sleep(60000);
//uid1 打卡
Response signRes = ContractSignService.doSign(actId, uid1);
String success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid1第7日打卡失败");
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
//homeInfoRes.prettyPrint();
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "完成7日打卡状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid1是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid1明日是否有奖励状态不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "完成打卡后期次号显示不正确");
Response recordRes = ContractSignService.getContracts(actId, uid1);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid1参与记录中完成状态不正确");
//uid2 7日打卡完成
signRes = ContractSignService.doSign(actId, uid2);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid2第7日打卡失败");
//uid3 7日打卡完成
signRes = ContractSignService.doSign(actId, uid3);
success = signRes.jsonPath().getString("success");
Assert.assertEquals(success, "true", "uid3第7日打卡失败");
}
@Test(description = "瓜分现金开奖, 活动ID=7" ,priority = 4,dependsOnMethods = { "瓜分现金整期完成" })
public void 瓜分现金开奖() throws Exception{
//修改期次,今日开奖
ContractSignCommon.modifyIssuePeriod(issueId, -1);
//修改期次后有1分钟缓存
ContractSignService.getHomeInfo(actId, uid1);
Thread.sleep(60000);
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid1);
//homeInfoRes.prettyPrint();
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "参与期次号不正确");
String status = homeInfoRes.jsonPath().getString("data.status");
Assert.assertEquals(status, "6", "当前参与状态不正确");
String hasReward = homeInfoRes.jsonPath().getString("data.hasReward");
Assert.assertEquals(hasReward, "true", "今日是否有奖励状态不正确");
//查询待领取奖励
Response recordRes = ContractSignService.getContracts(actId, uid1);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "WAIT_REWARD", "当前期次完成状态不正确");
String winCount = recordRes.jsonPath().getString("data.list[0].winCount");
Assert.assertEquals(winCount, "33333", "瓜分奖励金额不正确");
//领奖
Response rewardRes = ContractSignService.getReward(contractId1,uid1);
String rewardStatus = rewardRes.jsonPath().getString("success");
String rewardAmount = rewardRes.jsonPath().getString("data");
Assert.assertEquals(rewardStatus,"true","领取奖励结果不正确");
Assert.assertEquals(rewardAmount,winCount,"领取奖励金额不正确");
}
}
......@@ -97,7 +97,7 @@ public class ContractSign_CreditsCheating_signTest extends DuibaTestBase {
int totalCount_new = Integer.valueOf(homeInfoRes.jsonPath().getString("data.betTotalCount"));
Assert.assertEquals(totalCount_new, 11000, "报名后奖池数量不正确");
}
@Test(description = "瓜分积分作弊打卡, 活动ID=6" ,priority = 2)
@Test(description = "瓜分积分作弊打卡, 活动ID=6" ,priority = 2,dependsOnMethods = { "瓜分积分作弊报名" })
public void 瓜分积分作弊打卡() throws Exception {
//修改周期为打卡第一天
ContractSignCommon.modifyIssuePeriod(issueId,-1);
......@@ -140,7 +140,7 @@ public class ContractSign_CreditsCheating_signTest extends DuibaTestBase {
recordRes = ContractSignService.getContracts(actId, uid4);
contractId4 = recordRes.jsonPath().getString("data.list[0].contractId");
}
@Test(description = "瓜分积分作弊整期完成, 活动ID=6" ,priority = 3)
@Test(description = "瓜分积分作弊整期完成, 活动ID=6" ,priority = 3,dependsOnMethods = { "瓜分积分作弊打卡" })
public void 瓜分积分作弊整期完成() throws Exception {
//修改周期为打卡第七天
ContractSignCommon.modifyIssuePeriod(issueId,-6);
......@@ -168,6 +168,8 @@ public class ContractSign_CreditsCheating_signTest extends DuibaTestBase {
String hasRewardTomorrow = homeInfoRes.jsonPath().getString("data.hasRewardTomorrow");
Assert.assertEquals(hasReward, "false", "uid1是否有奖励状态不正确");
Assert.assertEquals(hasRewardTomorrow, "true", "uid1明日是否有奖励状态不正确");
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
Assert.assertEquals(periodShow, period_tomorrow, "完成打卡后期次号显示不正确");
Response recordRes = ContractSignService.getContracts(actId, uid1);
String doneStatus = recordRes.jsonPath().getString("data.list[0].doneStatus");
Assert.assertEquals(doneStatus, "DONE", "uid1参与记录中完成状态不正确");
......@@ -193,7 +195,7 @@ public class ContractSign_CreditsCheating_signTest extends DuibaTestBase {
Assert.assertEquals(success, "true", "uid6第7日打卡失败");
}
@Test(description = "瓜分积分作弊开奖, 活动ID=6" ,priority = 4)
@Test(description = "瓜分积分作弊开奖, 活动ID=6" ,priority = 4,dependsOnMethods = { "瓜分积分作弊整期完成" })
public void 瓜分积分作弊开奖() throws Exception {
//修改期次,今日开奖
ContractSignCommon.modifyIssuePeriod(issueId, -1);
......
......@@ -129,7 +129,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
Assert.assertEquals(betCount, betAmount3, "uid5报名额度显示不正确");
}
@Test(description = "多梯度签到,uid1,uid3,uid5, 活动ID=5", priority = 2)
@Test(description = "多梯度签到,uid1,uid3,uid5, 活动ID=5", priority = 2,dependsOnMethods = { "多梯度报名" })
public void 多梯度签到() throws Exception{
//修改期次,今日为打卡第一天
ContractSignCommon.modifyIssuePeriod(issueId, -1);
......@@ -199,7 +199,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
RedisUtil.clearKey(key);
}
@Test(description = "多梯度完成打卡",priority = 3)
@Test(description = "多梯度完成打卡",priority = 3,dependsOnMethods = { "多梯度签到" })
public void 多梯度完成打卡() throws Exception{
//修改期次,周期再往前移6天
ContractSignCommon.modifyIssuePeriod(issueId, -6);
......@@ -268,7 +268,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
}
@Test(description = "多梯度断签,uid5",priority = 4)
@Test(description = "多梯度断签,uid5",priority = 4,dependsOnMethods = { "多梯度完成打卡" })
public void 多梯度断签() throws Exception{
Response homeInfoRes = ContractSignService.getHomeInfo(actId, uid5);
String periodShow = homeInfoRes.jsonPath().getString("data.periodShow");
......@@ -295,7 +295,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
}
@Test(description = "开奖", priority = 5)
@Test(description = "开奖", priority = 5,dependsOnMethods = { "多梯度断签" })
public void 多梯度开奖() throws Exception{
ContractSignCommon.modifyIssuePeriod(issueId, -1);
//修改期次后有1分钟缓存
......@@ -351,7 +351,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
}
@Test(description = "多梯度领奖",priority = 6)
@Test(description = "多梯度领奖",priority = 6,dependsOnMethods = { "多梯度开奖" })
public void 多梯度领奖() throws Exception{
//uid2领奖
Response rewardRes = ContractSignService.getReward(contractId2,uid2);
......@@ -375,7 +375,7 @@ public class ContractSign_Multi_signTest extends DuibaTestBase {
Assert.assertEquals(desc,"领奖处理失败","uid1领取描述不正确");
}
//@Test(description = "多梯度中奖轮播",priority = 7)
//@Test(description = "多梯度中奖轮播",priority = 7,dependsOnMethods = { "多梯度领奖" })
public void 多梯度中奖轮播() throws Exception{
//删除redis key
String carouselKey = String.format("SIGNCENTER_K034_%s_%s", actId, issueId);
......
......@@ -237,7 +237,7 @@ public class ContractSign_signTest extends DuibaTestBase {
this.contractResign(actId, uid3, 7,false);
this.contractResign(actId, uid4, 7,false);
Response homeInfoRes = ContractSignService.getHomeInfo(actId,uid3);
logger.info("签到前");
//今日打卡
Response signRes = ContractSignService.doSign("2", uid3);
String success = signRes.jsonPath().getString("success");
......
package http.cases.SignTest;
import base.DuibaTestBase;
import http.service.Activity.ActivityPlugDrawInfoService;
import http.service.Activity.SignactivityService;
import http.service.Authorization;
import http.service.hd.SigninService;
import io.restassured.response.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.util.Map;
public class 签到定制接口_signTest extends DuibaTestBase {
@Autowired
SigninService signinService;
@Autowired
Authorization authorization;
@Autowired
SignactivityService signactivityService;
@Autowired
ActivityPlugDrawInfoService activityPlugDrawInfoService;
//指定用户
private int uid = 5430;
private String consumer_id = "100122062";
private Map<String,Object> map ;
@BeforeClass
public void beforeclass() {
map = authorization.dafuwengLogin(uid);
try {
jdbc.update("delete from sign_record.tb_sign_log where consumer_id = "+consumer_id+" and source_relation_id = 98");
jdbc.update("delete from sign_record.tb_sign_statics where consumer_id = "+consumer_id+" and source_relation_id = 98");
} catch (SQLException e) {
logger.info("数据库更新异常");
}
}
@Test(description = "活动id:98,规则:连续签到1天,加一次抽奖机会,自动抽奖")
public void 海底捞签到抽插件() throws Exception {
//当日签到之前插件信息查询
String actId = "98";
String pluginId = "3365";
Response response_plug = activityPlugDrawInfoService.getPrizeInfo(map,pluginId);
int limitCount = response_plug.jsonPath().getInt("limitCount");
logger.info("签到之前插件抽奖次数:"+limitCount);
//消耗抽奖次数
while(limitCount>0){
this.plug(uid,pluginId);
limitCount--;
}
response_plug = activityPlugDrawInfoService.getPrizeInfo(map,pluginId);
limitCount = response_plug.jsonPath().getInt("limitCount");
Assert.assertEquals(limitCount,0,"签到之前插件抽奖次数不正确");
logger.info("签到之前插件抽奖次数:"+limitCount);
//签到
Response response = signactivityService.doSign(map, actId);
String orderNum = response.jsonPath().getString("customInfo.orderNum");
logger.info("签到调用插件的orderNum:" + orderNum);
Assert.assertNotNull(orderNum);
response_plug = activityPlugDrawInfoService.getPrizeInfo(map,pluginId);
limitCount = response_plug.jsonPath().getInt("limitCount");
Assert.assertEquals(limitCount, 0,"调用插件后次数不为0");
}
//插件抽奖
private void plug(int uid,String id) throws Exception {
Response response = activityPlugDrawInfoService.doJoinPlugdraw(uid,id);
String orderId = response.jsonPath().getString("orderId");
response = activityPlugDrawInfoService.getOrderStatusPlugdraw(uid,orderId);
int i = 30;
while ("成功-等待".equals(response.jsonPath().getString("message")) && i > 0) {
Thread.sleep(1000);
response = activityPlugDrawInfoService.getOrderStatusPlugdraw(uid,orderId);
i--;
}
}
}
......@@ -277,6 +277,7 @@ public class 补签测试_signTest extends DuibaTestBase {
} catch (Error er) {
throw new Exception("/signin/configEdit接口失败,返回信息:" + response.asString());
}
Thread.sleep(61000);
// 查询补签前信息
Response signInfoRes = signactivityService.getSignInfo(authorization.dafuwengLogin(uid),"93");
String resignCount = signInfoRes.jsonPath().getString("signInfoVO.resignCount");
......@@ -331,6 +332,7 @@ public class 补签测试_signTest extends DuibaTestBase {
} catch (Error er) {
throw new Exception("/signin/configEdit接口失败,返回信息:" + response.asString());
}
Thread.sleep(61000);
// 补签前查询剩余补签次数
Response signInfoRes = signactivityService.getSignInfo(authorization.dafuwengLogin(uid),"94");
String resignCount = signInfoRes.jsonPath().getString("signInfoVO.resignCount");
......
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