假设结构如下:
Thread Group
-Simple Controller
-Global Response Assertion
-Http Sampler1
-Http Sampler2
-Http Sampler3
-Http Sampler4
etc
因此全局响应断言将适用于它下面的所有采样器。但是,我需要一种方法让特定采样器忽略全局断言,例如我希望 HTTP 采样器 4 不被全局断言断言并完全忽略它。
谢谢大家
最佳答案
鉴于你在标签中有 beanshell
我的期望是你的 Global Response Assertion
是 Beanshell Assertion .如果是这样 - 您可以“忽略”Http Sampler4
,如下所示:
if (SampleResult.getSampleLabel().equals("Http Sampler4")) {
// do nothing
}
else {
// your "global assertion" logic here
}
另请注意 starting from JMeter version 3.1 it is recommended to use Groovy for any form of scripting在 JMeter 中,因此请考虑迁移到 JSR223 Assertion在下一个可用的机会。
参见 Apache Groovy - Why and How You Should Use It指南了解更多详情。
关于jmeter - 忽略 Jmeter 中的全局响应断言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47834348/