JMeter 断言用于 API 响应,其中包含 [] 或字符串 “transaction”。

huangapple go评论76阅读模式
英文:

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

最简单的方法是使用配置如下的响应断言

JMeter 断言用于 API 响应,其中包含 [] 或字符串 “transaction”。

它将在以下两种情况下通过:

  • 当响应主体包含 []
  • 或者当响应主体包含 transaction

如果响应主体不包含其中任何一个 - 断言将失败。

更多信息:JMeter响应断言是什么?

英文:

The easiest is going for Response Assertion configured like:

JMeter 断言用于 API 响应,其中包含 [] 或字符串 “transaction”。

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?

huangapple
  • 本文由 发表于 2023年6月1日 15:08:02
  • 转载请务必保留本文链接:https://go.coder-hub.com/76379446.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定