Home > Enterprise >  How can I continue to iterate in a while controller even if I have a failed assertion in Jmeter?
How can I continue to iterate in a while controller even if I have a failed assertion in Jmeter?

Time:05-17

This is what I am doing. I am using a While controller to iterate a CSV data file. I set "STOP THREAD ON EOF" to true in the element "CSV Data Set Config" because I want to read all the data in the file.

Then I'm using the data extracted to make two http requests and then compare the responses to see if there are any differences (these are two soap requests using the same body request but reading from two different databases). I am using a BeanShell assertion to compare the response: if there is no difference I am using prev.setSuccessful(true); and so I have a green light; if there is some difference I am using prev.setSuccessful(false); and so I have a red light in my results tree. Doing this way as soon as I find a difference my iteration stops, but I would like to continue until I read all the data in the CSV file and I still want to have a red light so I can easily check where I have errors. My CSV file contains thousands of records and I want to make my http requests with all the data. Is that possibile even if I have a failed assertion?

This is my project tree.

This is my project tree.

Thank you !

CodePudding user response:

By default JMeter doesn't break any loops and should just continue in case of error. Check enter image description here

Also be informed that using Beanshell is a some form of a performance anti-pattern, since JMeter 3.1 you're supposed to be using JSR223 Test Elements and Groovy language for scripting so consider migrating to the JSR223 Assertion.

CodePudding user response:

I solved the issue putting ${__javascript("false")} in the While Controller condition

  • Related