英文:
JMeter assertion for a API response which contains [] or string "transaction"
问题
我们如何断言包含[]或"transaction"的API响应?
如果包含以下响应之一,Jmeter断言应该通过:
响应1:[](只有空方括号)
或
响应2:包含字符串"transaction"作为响应的一部分
英文:
How can we assert an API response which contains [] or "transaction"?
Jmeter Assertion should pass if it contains any of the below response
Response 1: [] (only empty square brackets)
or
Response 2: contains string "transaction" as part of response
答案1
得分: 0
最简单的方法是使用配置如下的响应断言:
它将在以下两种情况下通过:
- 当响应主体包含
[]
时 - 或者当响应主体包含
transaction
时
如果响应主体不包含其中任何一个 - 断言将失败。
更多信息:JMeter响应断言是什么?
英文:
The easiest is going for Response Assertion configured like:
It will pass in 2 cases:
- when response body will contain
[]
- or when response body will contain
transaction
if response body won't contain any of these - the assertion will fail.
More information: What Are JMeter Response Assertions?
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论