【发布时间】:2020-06-03 01:40:06
【问题描述】:
出于我的任务的目的,我需要将来自 JSON 的数据与来自 DB 的数据进行比较,但我对如何构建场景几乎没有疑问。我的场景是这样的:
1 执行数据库查询
返回动态集如:
url secret
https://test1.com/ 1234
https://test2.com/ 1234
https://test3.com/ 1234
基于这个动态集合,我驱动我的 Loop 控制器进行循环。每次调用都会生成不同的 JSON,例如:
[
{
"adminLink": "",
"BTCAmount": 0,
"lastName": "test",
"amount": 1,
"clientId": "e1d4ab18517711eaa84cfa163eb75a2c",
"foundingSourceName": "test",
"secretId": "2938663415",
"txId": "",
"mcTxId": "1079249234",
"paymentAddress": "",
"result": "transaction timed out",
"firstName": "test",
"phoneNumber": "",
"currency": "USD",
"refoundAmount": 0,
"approveTime": 1582543463,
"email": "",
"status": 1,
"timestamp": 1581938595
},
{
"adminLink": "",
"BTCAmount": 0,
"lastName": "test",
"amount": 550,
"clientId": "ffe22f34742311eab73f06ed6719cf46",
"foundingSourceName": "test",
"secretId": "3096308675",
"txId": "",
"mcTxId": "1101155492",
"paymentAddress": "",
"result": "transaction timed out",
"firstName": "test",
"phoneNumber": "",
"currency": "USD",
"refoundAmount": 0,
"approveTime": 1586355699,
"email": "",
"status": 1,
"timestamp": 1585750862
}
]
2 从这个动态 json 中,我可以提取:mcTxId with:
3。 对于每一个 mcTxId ,我需要使用以下命令执行 JDBC 查询:
select *
FROM affiliate_transaction
WHERE affiliate_id = 1 and mctxid = '${mcTxId_1}'
结果:
我设法解决了循环控制器,并提取了每一个 mcTxId,但我坚持使用嵌套循环逻辑,并断言每个数据。
我如何在 API 调用(json)和数据库查询之间比较/断言每个 clientId 和 approveTime,它们的数据集总是动态的?
非常感谢任何帮助。 为长篇道歉
【问题讨论】:
标签: jmeter