Commit a51cc5cf authored by 龚小红's avatar 龚小红

Merge branch 'Feature/20211015-gxh' into 'master'

修改测试用例描述

See merge request test-group/kejiji!141
parents 284ed0e5 ba1086cd
......@@ -7,9 +7,6 @@ import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
......@@ -86,50 +83,4 @@ public class OpenLive implements Authorization {
}
public void connectSuccess() {
Map<String, Object> connectSuccessParam = new HashMap<>();
connectSuccessParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(connectSuccessParam, BasicConfig.USER_connectSuccess);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(connectSuccessParam, BasicConfig.USER_connectSuccess, "访客到场请求失败", response.body().asString()));
}
@Test(description = "用户到场", priority = 3)
public void 用户到场() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException {
agentAuth();
connectSuccess();
visitorAuth1();
connectSuccess();
visitorAuth2();
connectSuccess();
visitorAuth3();
connectSuccess();
visitorAuth4();
connectSuccess();
visitorAuth5();
connectSuccess();
visitorAuth6();
connectSuccess();
visitorAuth7();
connectSuccess();
visitorAuth8();
connectSuccess();
visitorAuth9();
connectSuccess();
visitorAuth10();
connectSuccess();
visitorAuth11();
connectSuccess();
}
}
......@@ -9,6 +9,7 @@ import com.kjj.utils.ThreadSleepUtils;
import io.restassured.response.Response;
import org.apache.commons.lang3.BooleanUtils;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import java.util.HashMap;
......@@ -16,6 +17,8 @@ import java.util.List;
import java.util.Map;
import java.util.Objects;
import static com.kjj.utils.BaseUtils.*;
public class Lottery implements Authorization {
public List<ConfIdList> List_ConfId;
......@@ -23,6 +26,19 @@ public class Lottery implements Authorization {
public static String welfareName;
public static String lotteryConfId;
@BeforeClass
public void setUp() {
//代理人A/访客A/访客B到场
agentAuth();
connectSuccess();
visitorAuth1();
connectSuccess();
visitorAuth2();
connectSuccess();
}
@Test(description = "代理人抽奖活动弹层福利列表", priority = 1)
public void 抽奖活动弹层福利列表() {
agentAuth();
......@@ -264,27 +280,30 @@ public class Lottery implements Authorization {
@Test(description = "访客C关注直播间", priority = 24)
public void 访客C关注直播间() {
// 访客C/D/E/F/G到场
visitorAuth4();
connectSuccess();
visitorAuth5();
connectSuccess();
visitorAuth6();
connectSuccess();
visitorAuth7();
connectSuccess();
visitorAuth3();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
connectSuccess();
subscribelive();
}
@Test(description = "访客C抽奖码数量", priority = 25)
public void 访客C抽奖码数量() {
visitorAuth3();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
//好运红包
@Test(description = "分享者访客A获取好运红包", priority = 26)
public void 分享者访客A获取好运红包() {
......@@ -404,13 +423,7 @@ public class Lottery implements Authorization {
@Test(description = "访客A抽奖码数量", priority = 33)
public void 访客A抽奖码数量() {
visitorAuth1();
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(2);
}
......@@ -474,24 +487,13 @@ public class Lottery implements Authorization {
@Test(description = "访客D关注直播间", priority = 40)
public void 访客D关注直播间() {
visitorAuth4();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
subscribelive();
}
@Test(description = "访客D抽奖码数量", priority = 41)
public void 访客D抽奖码数量() {
visitorAuth4();
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
@Test(description = "访客E给访客B助力", priority = 44)
......@@ -512,24 +514,13 @@ public class Lottery implements Authorization {
@Test(description = "访客E关注直播间", priority = 46)
public void 访客E关注直播间() {
visitorAuth5();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = response.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", response.body().asString()));
subscribelive();
}
@Test(description = "访客E抽奖码数量", priority = 47)
public void 访客E抽奖码数量() {
visitorAuth5();
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
......@@ -551,24 +542,13 @@ public class Lottery implements Authorization {
@Test(description = "访客F关注直播间", priority = 52)
public void 访客F关注直播间() {
visitorAuth6();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
subscribelive();
}
@Test(description = "访客F抽奖码数量", priority = 53)
public void 访客F抽奖码数量() {
visitorAuth6();
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
......@@ -589,35 +569,16 @@ public class Lottery implements Authorization {
@Test(description = "访客G关注直播间", priority = 58)
public void 访客G关注直播间() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
visitorAuth7();
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
subscribelive();
agentAuth();
Response response = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data1 = response.jsonPath().getBoolean("data");
System.out.println(data1);
Assert.assertTrue(data1, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", response.body().asString()));
subscribelive();
}
@Test(description = "访客G抽奖码数量", priority = 59)
public void 访客G抽奖码数量() {
visitorAuth7();
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
......@@ -658,14 +619,7 @@ public class Lottery implements Authorization {
@Test(description = "访客B的抽奖码数量", priority = 62)
public void 访客B抽奖码数量() {
visitorAuth2();
ThreadSleepUtils.sleep(3000);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取访客B抽奖码数量失败", myCountRes.body().asString()));
codeCount(14);
}
@Test(description = "开始第二轮抽奖", priority = 63)
......@@ -917,25 +871,22 @@ public class Lottery implements Authorization {
@Test(description = "访客H关注直播间", priority = 78)
public void 访客H关注直播间() {
//// 访客H/I/J到场
visitorAuth8();
connectSuccess();
visitorAuth10();
connectSuccess();
visitorAuth9();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
connectSuccess();
subscribelive();
}
@Test(description = "访客H抽奖码数量", priority = 79)
public void 访客H抽奖码数量() {
visitorAuth9();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
......@@ -943,48 +894,26 @@ public class Lottery implements Authorization {
@Test(description = "访客I关注直播间", priority = 81)
public void 访客I关注直播间() {
visitorAuth8();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
subscribelive();
}
@Test(description = "访客I抽奖码数量", priority = 82)
public void 访客I抽奖码数量() {
visitorAuth8();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
@Test(description = "访客J关注直播间", priority = 84)
public void 访客J关注直播间() {
visitorAuth10();
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
subscribelive();
}
@Test(description = "访客J抽奖码数量", priority = 85)
public void 访客J抽奖码数量() {
visitorAuth10();
ThreadSleepUtils.sleep(1000);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(1);
}
......
......@@ -13,6 +13,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static com.kjj.utils.BaseUtils.codeCount;
public class LotteryCode implements Authorization {
public String shareSign;
......@@ -86,13 +88,7 @@ public class LotteryCode implements Authorization {
@Test(description = "访客A抽奖码数量", priority = 6)
public void 访客A抽奖码数量() {
visitorAuth1();
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId",LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
long data = myCountRes.jsonPath().getLong("data");
System.out.println(data);
Assert.assertNotNull(data, network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
codeCount(3);
}
@Test(description = "访客A查询抽奖券列表", priority = 7)
......
package com.kjj.utils;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.sql.KjyUserDB;
import com.kjj.sql.UserSqlFactory;
import io.restassured.response.Response;
import org.testng.Assert;
import org.testng.annotations.Test;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
......@@ -144,4 +147,39 @@ public class BaseUtils {
Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,network.message(params,MANAGER_updateTypeOrDate,"返回数据为空",response.body().asString()));
}
/*
* 访客到场
* */
public static void connectSuccess() {
Map<String, Object> connectSuccessParam = new HashMap<>();
connectSuccessParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response response = network.getResponse(connectSuccessParam, BasicConfig.USER_connectSuccess);
boolean success = response.jsonPath().getBoolean("success");
Assert.assertTrue(success, network.message(connectSuccessParam, BasicConfig.USER_connectSuccess, "访客到场请求失败", response.body().asString()));
}
/*
* 关注直播间
* */
public static void subscribelive() {
Map<String, Object> subscribeParam = new HashMap<>();
subscribeParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response subscribeRes = network.postResponse(subscribeParam, BasicConfig.USER_SUBSCRIBE);
boolean data = subscribeRes.jsonPath().getBoolean("data");
System.out.println(data);
Assert.assertTrue(data, network.message(subscribeParam, BasicConfig.USER_SUBSCRIBE, "关注失败", subscribeRes.body().asString()));
}
/*
* 抽奖码数量校验
* */
public static void codeCount(int num) {
ThreadSleepUtils.sleep(500);
Map<String, Object> myCountParam = new HashMap<>();
myCountParam.put("liveId", LiveConstants.getValue(LiveConstants.StringKeyEnum.ENCODE_LIVE_ID.getKey()));
Response myCountRes = network.getResponse(myCountParam, BasicConfig.USER_myCount);
int data = myCountRes.jsonPath().getInt("data");
Assert.assertEquals(data, num ,network.message(myCountParam, BasicConfig.USER_myCount, "获取抽奖码数量失败", myCountRes.body().asString()));
}
}
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