[英]I am unable to ignore the failed response code/message using BeanShell PostProcessor in JMeter
I am having multiple sampler in which i am trying to setup a script which ignores an error message or any response code and tryinh to make a sampler as "pass".我有多个采样器,我试图在其中设置一个忽略错误消息或任何响应代码的脚本,并尝试将采样器设置为“通过”。
but i am unable to do that.但我做不到。
Below is my configuration.下面是我的配置。
JMeter Configuration for BeanShell Post Processor JMeter BeanShell 后处理器的配置
You can see that in an benshell postprocessor i tries to ignore 3 responses (non http, 504 and 401)您可以看到,在 benshell 后处理器中,我试图忽略 3 个响应(非 http、504 和 401)
But in the "View Result Tree" listner i am still getting ignored status code as failed.但是在“查看结果树”监听器中,我仍然被忽略为失败的状态代码。
You can see in an image that 401 error code request is failed.您可以在图像中看到 401 错误代码请求失败。
Can you please let me know what i am doing wrong here.你能告诉我我在这里做错了什么吗?
I also tried jsr223 response assertion,but not able to get expected output.我还尝试了 jsr223 响应断言,但无法获得预期的 output。
I also checked my logs as well.我也检查了我的日志。
There are multiple problems with your script:您的脚本存在多个问题:
==
instead of equals()
which compares references and not instances so it might be the case the code is not executed at all您正在使用==
而不是比较引用而不是实例的equals()
所以可能是代码根本没有执行的情况200
is not sufficient to suppress the failure, you need to additionally invoke prev.setSuccessful(true)
function将响应代码设置为200
不足以抑制失败,您需要额外调用prev.setSuccessful(true)
functionHello why you use JMeter do you know K6: https://k6.io/ It's better than JMeter你好为什么用JMeter你知道K6吗: https://k6.io/比JMeter好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.