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

修改测试用例描述

parent ade9d905
...@@ -7,9 +7,6 @@ import io.restassured.response.Response; ...@@ -7,9 +7,6 @@ import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -86,50 +83,4 @@ public class OpenLive implements Authorization { ...@@ -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();
}
} }
...@@ -13,6 +13,8 @@ import java.util.HashMap; ...@@ -13,6 +13,8 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import static com.kjj.utils.BaseUtils.codeCount;
public class LotteryCode implements Authorization { public class LotteryCode implements Authorization {
public String shareSign; public String shareSign;
...@@ -86,13 +88,7 @@ public class LotteryCode implements Authorization { ...@@ -86,13 +88,7 @@ public class LotteryCode implements Authorization {
@Test(description = "访客A抽奖码数量", priority = 6) @Test(description = "访客A抽奖码数量", priority = 6)
public void 访客A抽奖码数量() { public void 访客A抽奖码数量() {
visitorAuth1(); visitorAuth1();
Map<String, Object> myCountParam = new HashMap<>(); codeCount(3);
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()));
} }
@Test(description = "访客A查询抽奖券列表", priority = 7) @Test(description = "访客A查询抽奖券列表", priority = 7)
......
package com.kjj.utils; package com.kjj.utils;
import com.kjj.config.BasicConfig;
import com.kjj.constants.LiveConstants;
import com.kjj.sql.KjyUserDB; import com.kjj.sql.KjyUserDB;
import com.kjj.sql.UserSqlFactory; import com.kjj.sql.UserSqlFactory;
import io.restassured.response.Response; import io.restassured.response.Response;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test;
import java.sql.SQLException; import java.sql.SQLException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
...@@ -144,4 +147,39 @@ public class BaseUtils { ...@@ -144,4 +147,39 @@ public class BaseUtils {
Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString())); Assert.assertTrue(success,network.message(params,MANAGER_updateTypeOrDate,"接口返回失败",response.body().asString()));
Assert.assertTrue(result,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