我的测试计划如下:
Thread group
\_..other items
\_While controller (with blank condition)
\_Web socket single read sampler
\_..other items
我的问题是,由于我使用空白条件,因此While控制器将执行直到采样器错误为止。所以我的问题是,有没有办法过滤掉最后一个采样器?由于必须执行子采样器的次数不是恒定的,因此在While控制器中没有其他条件可以使用。
谢谢!
答案 0 :(得分:0)
将以下代码放入“脚本”区域:
if (!prev.isSuccessful()) {
prev.setIgnore()
}
在上面的代码中,prev
代表父SampleResult,而setIgnore()函数告诉JMeter不要为给定的Sampler收集结果。
有关此快捷方式和其他JMeter API快捷方式的更多信息:Top 8 JMeter Java Classes You Should Be Using with Groovy