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
You can see that in an benshell postprocessor i tries to ignore 3 responses (non http , 504 and 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.
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.
I also checked my logs as well.
CodePudding user response:
There are multiple problems with your script:
- You're using
==
instead ofequals()
which compares references and not instances so it might be the case the code is not executed at all - Setting response code to
200
is not sufficient to suppress the failure, you need to additionally invokeprev.setSuccessful(true)
function - Since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting because Groovy performance is much better comparing to Beanshell
- You might want to use switch statement instead of multiple if/else clauses
CodePudding user response:
Hello why you use JMeter do you know K6 : https://k6.io/ It's better than JMeter