Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
askbooks
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
齐文博
askbooks
Commits
a56be201
Commit
a56be201
authored
Sep 25, 2023
by
左磊磊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
0925更新Excel文件,删除一些case
parent
038504e2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
319 deletions
+7
-319
PayCase.java
src/test/java/com/lemon/cases/PayCase.java
+6
-6
Rays7ServerCase.java
src/test/java/com/lemon/cases/Rays7ServerCase.java
+1
-1
ServerTwoCase.java
src/test/java/com/lemon/cases/ServerTwoCase.java
+0
-312
RAYS7.xls
src/test/resources/RAYS7.xls
+0
-0
RAYS7服务-磊磊.xls
src/test/resources/RAYS7服务-磊磊.xls
+0
-0
No files found.
src/test/java/com/lemon/cases/PayCase.java
View file @
a56be201
...
@@ -57,11 +57,11 @@ public class PayCase extends BaseCase {
...
@@ -57,11 +57,11 @@ public class PayCase extends BaseCase {
public
Object
[][]
datas0
()
{
public
Object
[][]
datas0
()
{
//Object[m][n] m代表执行次数,n代表参数个数
//Object[m][n] m代表执行次数,n代表参数个数
Object
[][]
datas
=
{
Object
[][]
datas
=
{
{
1
,
"RAYS自跳RAYS"
,
"https://weixin23.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=23"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":23,\"payAccounts\":23,\"officialAccountsName\":\"书童小睿\",\"domain\":\"weixin23.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/png/942c1c8f4f2a7bc81f82743c48bbaa1a.png\",\"description\":\"属于你的双十一狂欢会\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
},
// RAYS跳RAYS
{
1
,
"RAYS自跳RAYS"
,
"https://weixin23.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=23"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":23,\"payAccounts\":23,\"officialAccountsName\":\"书童小睿\",\"domain\":\"weixin23.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/png/942c1c8f4f2a7bc81f82743c48bbaa1a.png\",\"description\":\"属于你的双十一狂欢会\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wx833c9707dcafe1c0\"}}"
},
{
2
,
"蓝海生态跳RAYS"
,
"https://weixin28.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=28"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":28,\"payAccounts\":23,\"officialAccountsName\":\"RAYS蓝海生态\",\"domain\":\"weixin28.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/bbee8ff1fe52e5c58ab669d937a7f406.jpg\",\"description\":\"RAYS,给你别致的读书体验\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
},
// 蓝海生态跳RAYS
{
2
,
"蓝海生态跳RAYS"
,
"https://weixin28.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=28"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":28,\"payAccounts\":23,\"officialAccountsName\":\"RAYS蓝海生态\",\"domain\":\"weixin28.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/bbee8ff1fe52e5c58ab669d937a7f406.jpg\",\"description\":\"RAYS,给你别致的读书体验\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wxb700ce984a880a88\"}}"
},
{
3
,
"上海教育跳RAYS"
,
"https://weixin65750.rayswdcb.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65750"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65750,\"payAccounts\":23,\"officialAccountsName\":\"上海教育出版社有限公司\",\"domain\":\"weixin65750.rayswdcb.com\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat75903.rayswang.com\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/a7684e17ab41c8e43e7576e7321b8a77.jpg\",\"description\":\"上海教育出版社有限公司\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
},
// 上海教育跳RAYS
{
3
,
"上海教育跳RAYS"
,
"https://weixin65750.rayswdcb.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65750"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65750,\"payAccounts\":23,\"officialAccountsName\":\"上海教育出版社有限公司\",\"domain\":\"weixin65750.rayswdcb.com\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat75903.rayswang.com\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/a7684e17ab41c8e43e7576e7321b8a77.jpg\",\"description\":\"上海教育出版社有限公司\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wx25299e936b90c7d5\"}}"
},
{
4
,
"小蓝书跳小蓝书"
,
"https://weixin65842.rayshbjy.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65842"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65842,\"payAccounts\":65842,\"officialAccountsName\":\"小蓝书高中生服务平台\",\"domain\":\"weixin65842.rayshbjy.com\",\"payDomain\":\"weixin65842.rayshbjy.com\",\"manageDomain\":\"wechat65842.rayshbjy.com\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/3c1aa1fa65912a1a2673bc6ca05039d2.jpg\",\"description\":\"小蓝书携手一线教研专家,为全国高中生提供一站式服务:教育资讯、新高考选科工具,优质图书、课程推荐,专家、学霸交流等。\",\"iosAlipayOpen\":0,\"payMchId\":\"1521882781\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
},
// 小蓝书跳小蓝书
{
4
,
"小蓝书跳小蓝书"
,
"https://weixin65842.rayshbjy.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65842"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65842,\"payAccounts\":65842,\"officialAccountsName\":\"小蓝书高中生服务平台\",\"domain\":\"weixin65842.rayshbjy.com\",\"payDomain\":\"weixin65842.rayshbjy.com\",\"manageDomain\":\"wechat65842.rayshbjy.com\",\"icon\":\"https://oss.5rs.me/oss/uploadfe/jpg/3c1aa1fa65912a1a2673bc6ca05039d2.jpg\",\"description\":\"小蓝书携手一线教研专家,为全国高中生提供一站式服务:教育资讯、新高考选科工具,优质图书、课程推荐,专家、学霸交流等。\",\"iosAlipayOpen\":0,\"payMchId\":\"1521882781\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wxe8292f5327e2dda9\"}}"
},
{
5
,
"新世纪跳新世纪"
,
"https://weixin65700.rayscjsn.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65700"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65700,\"payAccounts\":65998,\"officialAccountsName\":\"广东新世纪出版社有限公司\",\"domain\":\"weixin65700.rayscjsn.com\",\"payDomain\":\"wechat65700.rayscjsn.com\",\"manageDomain\":\"wechat65700.rayscjsn.com\",\"icon\":\"https://oss.5rs.me/resources/jpg/j5zxhrw9N3EqbCR7oVFTHaP4W2DByZmg.jpg\",\"iosAlipayOpen\":0,\"payMchId\":\"1594177521\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
}
// 新世纪跳新世纪
{
5
,
"新世纪跳新世纪"
,
"https://weixin65700.rayscjsn.com/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=65700"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":65700,\"payAccounts\":65998,\"officialAccountsName\":\"广东新世纪出版社有限公司\",\"domain\":\"weixin65700.rayscjsn.com\",\"payDomain\":\"wechat65700.rayscjsn.com\",\"manageDomain\":\"wechat65700.rayscjsn.com\",\"icon\":\"https://oss.5rs.me/resources/jpg/j5zxhrw9N3EqbCR7oVFTHaP4W2DByZmg.jpg\",\"iosAlipayOpen\":0,\"payMchId\":\"1594177521\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wx3006f8db8a34cf9d\"}}"
}
};
};
return
datas
;
return
datas
;
}
}
...
@@ -100,7 +100,7 @@ public class PayCase extends BaseCase {
...
@@ -100,7 +100,7 @@ public class PayCase extends BaseCase {
public
Object
[][]
datas1
()
{
public
Object
[][]
datas1
()
{
//Object[m][n] m代表执行次数,n代表参数个数
//Object[m][n] m代表执行次数,n代表参数个数
Object
[][]
datas
=
{
Object
[][]
datas
=
{
{
1
,
"小睿伴学支付跳RAYS"
,
"https://wechat50687.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=50687"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":50687,\"payAccounts\":23,\"officialAccountsName\":\"小睿伴学\",\"domain\":\"wechat50687.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/upload/image/jpg/bb8353c7cec744b99060ca3bf31b72f0.jpg\",\"description\":\"小睿伴学\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
}}"
}
// 小睿伴学获取支付信息
{
1
,
"小睿伴学支付跳RAYS"
,
"https://wechat50687.5rs.me/channelcenter/v1.0/accountSetting/getOpreateManageInfo?officialAccountsId=50687"
,
"{\"errCode\":0,\"message\":\"操作成功!\",\"data\":{\"officialAccountsId\":50687,\"payAccounts\":23,\"officialAccountsName\":\"小睿伴学\",\"domain\":\"wechat50687.5rs.me\",\"payDomain\":\"weixin23.5rs.me\",\"manageDomain\":\"wechat22.5rs.me\",\"icon\":\"https://oss.5rs.me/oss/upload/image/jpg/bb8353c7cec744b99060ca3bf31b72f0.jpg\",\"description\":\"小睿伴学\",\"iosAlipayOpen\":0,\"payMchId\":\"1639325477\",\"currentPagePay\":0,\"phoneAuthOpen\":0,\"payMethod\":1
,\"developerAppId\":\"wx180de5a9db184161\"}}"
},
};
};
return
datas
;
return
datas
;
}
}
...
...
src/test/java/com/lemon/cases/Rays7ServerCase.java
View file @
a56be201
...
@@ -17,7 +17,7 @@ import java.util.Arrays;
...
@@ -17,7 +17,7 @@ import java.util.Arrays;
public
class
Rays7ServerCase
extends
BaseCase
{
public
class
Rays7ServerCase
extends
BaseCase
{
@Test
(
dataProvider
=
"datas0"
)
@Test
(
dataProvider
=
"datas0"
)
@Description
(
"
获取商户号支付信息
"
)
@Description
(
"
执行RAYS7服务
"
)
public
void
testManager
(
int
id
,
String
casename
,
String
url
,
String
json
,
String
expectValue
)
throws
Exception
{
public
void
testManager
(
int
id
,
String
casename
,
String
url
,
String
json
,
String
expectValue
)
throws
Exception
{
// String token = "430f837c00f9978dffec9d4c0c05c751";
// String token = "430f837c00f9978dffec9d4c0c05c751";
// 创建post请求
// 创建post请求
...
...
src/test/java/com/lemon/cases/ServerTwoCase.java
deleted
100644 → 0
View file @
038504e2
package
com
.
lemon
.
cases
;
import
com.alibaba.fastjson.JSONPath
;
import
com.lemon.constants.Constants
;
import
com.lemon.pojo.API
;
import
com.lemon.pojo.Case
;
import
com.lemon.utils.AuthorizationUtils
;
import
com.lemon.utils.ExcelUtils
;
import
com.lemon.utils.SqlUtils
;
import
io.qameta.allure.Description
;
import
io.qameta.allure.Step
;
import
org.apache.commons.lang3.StringUtils
;
import
org.testng.annotations.DataProvider
;
import
org.testng.annotations.Test
;
import
org.testng.Assert
;
import
java.util.Date
;
import
java.math.BigDecimal
;
import
java.text.DecimalFormat
;
public
class
ServerTwoCase
extends
BaseCase
{
@Test
(
dataProvider
=
"data4"
,
description
=
"推送消息-第2段部分匹配判断"
)
// DTO数据传输
@Description
(
"推送消息-第2段部分匹配判断"
)
public
void
testManager4
(
API
api
,
Case
cas
)
throws
Exception
{
//0、执行前休眠30秒
Thread
.
sleep
(
1000
*
30
);
//1、参数化替换
String
params
=
replace
(
cas
.
getParams
());
String
sql
=
replace
(
cas
.
getCheckSQL
());
String
Bsql
=
replace
(
cas
.
getCheckBSQL
());
cas
.
setParams
(
params
);
cas
.
setCheckSQL
(
sql
);
cas
.
setCheckBSQL
(
Bsql
);
//2、数据库前置查询结果(断言必须在接口执行前后都查询)
Object
beforeASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
Object
beforeBSqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckBSQL
());
//3、调用接口
String
body
=
call
(
api
,
cas
,
false
);
// 3.1 将登录的token存储(仅限于登录接口特有)
AuthorizationUtils
.
storeToken
(
body
);
// System.out.println(AuthorizationUtils.env);
//4、断言响应结果,Excel中预期响应数据与实际响应数据进行对比
boolean
assertResponseFlag
=
assertResponse
(
cas
,
body
);
//5、添加接口响应回写excel内容
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ACTURL_WRITER_BACK_CELL_NUM
,
body
);
//6、数据库后置查询结果
System
.
out
.
println
(
"A-sql: "
+
cas
.
getCheckSQL
());
Object
afterASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
System
.
out
.
println
(
"B-sql: "
+
cas
.
getCheckBSQL
());
Thread
.
sleep
(
1000
*
30
);
//验证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
());
String
assertSqlAFlag
=
(
sqlAFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
A_ASSERT_RESULT_CELL_NUM
,
assertSqlAFlag
);
System
.
out
.
println
(
"数据库A-sql断言结果:"
+
sqlAFlag
);
//7-2、B段数据库断言
boolean
sqlBFlag
=
assertSqlB
(
cas
.
getbExpectValue
(),
beforeBSqlResult
==
null
?
null
:
beforeBSqlResult
.
toString
());
String
assertSqlBFlag
=
(
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
B_ASSERT_RESULT_CELL_NUM
,
assertSqlBFlag
);
System
.
out
.
println
(
"数据库B-sql断言结果:"
+
sqlBFlag
);
//8、添加断言回写内容
String
assertContent
=
(
assertResponseFlag
&&
sqlAFlag
&&
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ASSERT_RESULT_CELL_NUM
,
assertContent
);
//9、添加日志
//10、报表断言
Assert
.
assertEquals
(
assertContent
,
"Pass"
);
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider
(
name
=
"data4"
)
public
Object
[][]
data4
()
{
Object
[][]
data
=
ExcelUtils
.
getAPIAndCaseByApiId
(
"1"
);
// 传参apiID
return
data
;
}
@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
);
//1、参数化替换
String
params
=
replace
(
cas
.
getParams
());
String
sql
=
replace
(
cas
.
getCheckSQL
());
String
Bsql
=
replace
(
cas
.
getCheckBSQL
());
cas
.
setParams
(
params
);
cas
.
setCheckSQL
(
sql
);
cas
.
setCheckBSQL
(
Bsql
);
//2、数据库前置查询结果(断言必须在接口执行前后都查询)
Object
beforeASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
Object
beforeBSqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckBSQL
());
//3、调用接口
String
body
=
call
(
api
,
cas
,
false
);
// 3.1 将登录的token存储(仅限于登录接口特有)
AuthorizationUtils
.
storeToken
(
body
);
// System.out.println(AuthorizationUtils.env);
//4、断言响应结果,Excel中预期响应数据与实际响应数据进行对比
boolean
assertResponseFlag
=
assertResponse
(
cas
,
body
);
//5、添加接口响应回写excel内容
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ACTURL_WRITER_BACK_CELL_NUM
,
body
);
//6、数据库后置查询结果
System
.
out
.
println
(
"A-sql: "
+
cas
.
getCheckSQL
());
Object
afterASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
System
.
out
.
println
(
"B-sql: "
+
cas
.
getCheckBSQL
());
Thread
.
sleep
(
1000
*
30
);
//验证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
());
String
assertSqlAFlag
=
(
sqlAFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
A_ASSERT_RESULT_CELL_NUM
,
assertSqlAFlag
);
System
.
out
.
println
(
"数据库A-sql断言结果:"
+
sqlAFlag
);
//7-2、B段数据库断言
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
);
//8、添加断言回写内容
String
assertContent
=
(
assertResponseFlag
&&
sqlAFlag
&&
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ASSERT_RESULT_CELL_NUM
,
assertContent
);
//9、添加日志
//10、报表断言
Assert
.
assertEquals
(
assertContent
,
"Pass"
);
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider
(
name
=
"data1"
)
public
Object
[][]
data1
()
{
Object
[][]
data
=
ExcelUtils
.
getAPIAndCaseByApiId
(
"2"
);
// 传参apiID
return
data
;
}
@Test
(
dataProvider
=
"data5"
,
description
=
"推送消息-第2段部分匹配判断"
)
// DTO数据传输
@Description
(
"推送消息-第2段部分匹配判断"
)
public
void
testManager5
(
API
api
,
Case
cas
)
throws
Exception
{
//0、执行前休眠30秒
Thread
.
sleep
(
1000
*
30
);
//1、参数化替换
String
params
=
replace
(
cas
.
getParams
());
String
sql
=
replace
(
cas
.
getCheckSQL
());
String
Bsql
=
replace
(
cas
.
getCheckBSQL
());
cas
.
setParams
(
params
);
cas
.
setCheckSQL
(
sql
);
cas
.
setCheckBSQL
(
Bsql
);
//2、数据库前置查询结果(断言必须在接口执行前后都查询)
Object
beforeASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
Object
beforeBSqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckBSQL
());
//3、调用接口
String
body
=
call
(
api
,
cas
,
false
);
// 3.1 将登录的token存储(仅限于登录接口特有)
AuthorizationUtils
.
storeToken
(
body
);
// System.out.println(AuthorizationUtils.env);
//4、断言响应结果,Excel中预期响应数据与实际响应数据进行对比
boolean
assertResponseFlag
=
assertResponse
(
cas
,
body
);
//5、添加接口响应回写excel内容
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ACTURL_WRITER_BACK_CELL_NUM
,
body
);
//6、数据库后置查询结果
System
.
out
.
println
(
"A-sql: "
+
cas
.
getCheckSQL
());
Object
afterASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
System
.
out
.
println
(
"B-sql: "
+
cas
.
getCheckBSQL
());
Thread
.
sleep
(
1000
*
60
);
//验证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
());
String
assertSqlAFlag
=
(
sqlAFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
A_ASSERT_RESULT_CELL_NUM
,
assertSqlAFlag
);
System
.
out
.
println
(
"数据库A-sql断言结果:"
+
sqlAFlag
);
//7-2、B段数据库断言
boolean
sqlBFlag
=
assertSqlB
(
cas
.
getbExpectValue
(),
beforeBSqlResult
==
null
?
null
:
beforeBSqlResult
.
toString
());
String
assertSqlBFlag
=
(
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
B_ASSERT_RESULT_CELL_NUM
,
assertSqlBFlag
);
System
.
out
.
println
(
"数据库B-sql断言结果:"
+
sqlBFlag
);
//8、添加断言回写内容
String
assertContent
=
(
assertResponseFlag
&&
sqlAFlag
&&
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ASSERT_RESULT_CELL_NUM
,
assertContent
);
//9、添加日志
//10、报表断言
Assert
.
assertEquals
(
assertContent
,
"Pass"
);
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider
(
name
=
"data5"
)
public
Object
[][]
data5
()
{
Object
[][]
data
=
ExcelUtils
.
getAPIAndCaseByApiId
(
"3"
);
// 传参apiID
return
data
;
}
@Test
(
dataProvider
=
"data6"
,
description
=
"推送消息-校验第1段和第2段"
)
// DTO数据传输
@Description
(
"推送消息-校验第1段和第2段"
)
public
void
testManager6
(
API
api
,
Case
cas
)
throws
Exception
{
//0、执行前休眠30秒
Thread
.
sleep
(
1000
*
30
);
//1、参数化替换
String
params
=
replace
(
cas
.
getParams
());
String
sql
=
replace
(
cas
.
getCheckSQL
());
String
Bsql
=
replace
(
cas
.
getCheckBSQL
());
cas
.
setParams
(
params
);
cas
.
setCheckSQL
(
sql
);
cas
.
setCheckBSQL
(
Bsql
);
//2、数据库前置查询结果(断言必须在接口执行前后都查询)
Object
beforeASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
Object
beforeBSqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckBSQL
());
//3、调用接口
String
body
=
call
(
api
,
cas
,
false
);
// 3.1 将登录的token存储(仅限于登录接口特有)
AuthorizationUtils
.
storeToken
(
body
);
// System.out.println(AuthorizationUtils.env);
//4、断言响应结果,Excel中预期响应数据与实际响应数据进行对比
boolean
assertResponseFlag
=
assertResponse
(
cas
,
body
);
//5、添加接口响应回写excel内容
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ACTURL_WRITER_BACK_CELL_NUM
,
body
);
//6、数据库后置查询结果
System
.
out
.
println
(
"A-sql: "
+
cas
.
getCheckSQL
());
Object
afterASqlResult
=
SqlUtils
.
querySingle
(
cas
.
getCheckSQL
());
System
.
out
.
println
(
"B-sql: "
+
cas
.
getCheckBSQL
());
Thread
.
sleep
(
1000
*
60
);
//验证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
());
String
assertSqlAFlag
=
(
sqlAFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
A_ASSERT_RESULT_CELL_NUM
,
assertSqlAFlag
);
System
.
out
.
println
(
"数据库A-sql断言结果:"
+
sqlAFlag
);
//7-2、B段数据库断言
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
);
//8、添加断言回写内容
String
assertContent
=
(
assertResponseFlag
&&
sqlAFlag
&&
sqlBFlag
)
?
"Pass"
:
"Fail"
;
addWBD
(
Integer
.
parseInt
(
cas
.
getId
()),
Constants
.
ASSERT_RESULT_CELL_NUM
,
assertContent
);
//9、添加日志
//10、报表断言
Assert
.
assertEquals
(
assertContent
,
"Pass"
);
}
// 使用Excel文件传输接口信息和请求信息
@DataProvider
(
name
=
"data6"
)
public
Object
[][]
data6
()
{
Object
[][]
data
=
ExcelUtils
.
getAPIAndCaseByApiId
(
"4"
);
// 传参apiID
return
data
;
}
/* @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;
}*/
}
src/test/resources/RAYS7.xls
View file @
a56be201
No preview for this file type
src/test/resources/RAYS7服务-磊磊.xls
View file @
a56be201
No preview for this file type
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment