Commit 9ff2886e by 左磊磊

add:2023年7月21日新增代码

parent c4efb1d9
......@@ -19,8 +19,8 @@ import java.math.BigDecimal;
import java.text.DecimalFormat;
public class ServerCase extends BaseCase {
@Test(dataProvider = "data1", description = "数字人推送消息") // DTO数据传输
@Description("数字人推送消息")
@Test(dataProvider = "data1", description = "推送消息-校验第1段和第2段") // DTO数据传输
@Description("推送消息-校验第1段和第2段")
public void testManager(API api, Case cas) throws Exception {
//0、执行前休眠30秒
Thread.sleep(1000 * 30);
......@@ -47,7 +47,7 @@ public class ServerCase extends BaseCase {
System.out.println("A-sql: " + cas.getCheckSQL());
Object afterASqlResult = SqlUtils.querySingle(cas.getCheckSQL());
System.out.println("B-sql: " + cas.getCheckBSQL());
Thread.sleep(1000 * 60);
Thread.sleep(1000 * 120); //验证B段SQL的休眠时间60秒
Object afterBSqlResult = SqlUtils.querySingle(cas.getCheckBSQL());
//7-1、A段数据库断言
boolean sqlAFlag = assertSql(cas.getaExpectValue(), beforeASqlResult == null ? null : beforeASqlResult.toString(), afterASqlResult == null ? null : afterASqlResult.toString());
......@@ -75,4 +75,67 @@ public class ServerCase extends BaseCase {
}
@Test(dataProvider = "data2", description = "推送图片-校验第2段") // DTO数据传输
@Description("推送图片-校验第2段")
public void testManager2(API api, Case cas) throws Exception {
Thread.sleep(1000 * 30);
String params = replace(cas.getParams());
String Bsql = replace(cas.getCheckBSQL());
cas.setParams(params);
cas.setCheckBSQL(Bsql);
Object beforeBSqlResult = SqlUtils.querySingle(cas.getCheckBSQL());
String body = call(api, cas, false);
AuthorizationUtils.storeToken(body);
boolean assertResponseFlag = assertResponse(cas, body);
addWBD(Integer.parseInt(cas.getId()), Constants.ACTURL_WRITER_BACK_CELL_NUM, body);
System.out.println("B-sql: " + cas.getCheckBSQL());
Thread.sleep(1000 * 240);
Object afterBSqlResult = SqlUtils.querySingle(cas.getCheckBSQL());
boolean sqlBFlag = assertSql(cas.getbExpectValue(), beforeBSqlResult == null ? null : beforeBSqlResult.toString(), afterBSqlResult == null ? null : afterBSqlResult.toString());
String assertSqlBFlag = (sqlBFlag) ? "Pass" : "Fail";
addWBD(Integer.parseInt(cas.getId()), Constants.B_ASSERT_RESULT_CELL_NUM, assertSqlBFlag);
System.out.println("数据库B-sql断言结果:" + sqlBFlag);
String assertContent = (assertResponseFlag && sqlBFlag) ? "Pass" : "Fail";
addWBD(Integer.parseInt(cas.getId()), Constants.ASSERT_RESULT_CELL_NUM, assertContent);
Assert.assertEquals(assertContent, "Pass");
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider(name = "data2")
public Object[][] data2() {
Object[][] data = ExcelUtils.getAPIAndCaseByApiId("2"); // 传参apiID
return data;
}
@Test(dataProvider = "data3", description = "推送消息-校验第1段") // DTO数据传输
@Description("推送消息-校验第1段")
public void testManager3(API api, Case cas) throws Exception {
Thread.sleep(1000 * 30);
String params = replace(cas.getParams());
String Bsql = replace(cas.getCheckBSQL());
cas.setParams(params);
cas.setCheckBSQL(Bsql);
Object beforeBSqlResult = SqlUtils.querySingle(cas.getCheckBSQL());
String body = call(api, cas, false);
AuthorizationUtils.storeToken(body);
boolean assertResponseFlag = assertResponse(cas, body);
addWBD(Integer.parseInt(cas.getId()), Constants.ACTURL_WRITER_BACK_CELL_NUM, body);
System.out.println("B-sql: " + cas.getCheckBSQL());
Thread.sleep(1000 * 60);
Object afterBSqlResult = SqlUtils.querySingle(cas.getCheckBSQL());
boolean sqlBFlag = assertSql(cas.getbExpectValue(), beforeBSqlResult == null ? null : beforeBSqlResult.toString(), afterBSqlResult == null ? null : afterBSqlResult.toString());
String assertSqlBFlag = (sqlBFlag) ? "Pass" : "Fail";
addWBD(Integer.parseInt(cas.getId()), Constants.B_ASSERT_RESULT_CELL_NUM, assertSqlBFlag);
System.out.println("数据库B-sql断言结果:" + sqlBFlag);
String assertContent = (assertResponseFlag && sqlBFlag) ? "Pass" : "Fail";
addWBD(Integer.parseInt(cas.getId()), Constants.ASSERT_RESULT_CELL_NUM, assertContent);
Assert.assertEquals(assertContent, "Pass");
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider(name = "data3")
public Object[][] data3() {
Object[][] data = ExcelUtils.getAPIAndCaseByApiId("3"); // 传参apiID
return data;
}
}
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