0

Here I'm facing one problem with if controller.using JSR223 Assertion to Extract the Response in Jmeter like this it is in One Thread Group

def threadName = Thread.currentThread().getName()
threadName = threadName.substring(threadName.lastIndexOf('-') + 1)

def response = new groovy.json.JsonSlurper().parse(prev.getResponseData())

props.put('Error_code_' + threadName, response.error)
props.put('Id_value_' + threadName, response.error_description)

so it is giving like this output

Error_code_1=200
Error_code_10=400
Error_code_2=400
Error_code_3=200

Id_value_1=60218
Id_value_10=noid
Id_value_2=noid
Id_value_3=60219

in very Next Thread Group i am validating Error_code_ in side if Controller like this

"${__P(Error_code_${__counter(,)},)}"=="200"

and i am putting id_values inside Http request there are 3 Http request.So when i run script the if condition is not properly validating. it also taking 400 error code also is there any way to see what value passing if condition or print it log file or else any thing wrong in this approach please tell me is there any alternative to this stuff.please explain me with simple demo.

Description

0

1 Answer 1

2

The easiest way of debugging If Controller is enabling logging for it, you can do it in 2 ways:

  1. From JMeter GUI having the If Controller selected choose Help -> Enable Debug

    JMeter enable Debug

  2. Or by adding the next line to log4j2.xml file (lives under "bin" folder of your JMeter installation)

    <Logger name="org.apache.jmeter.control.IfController" level="debug" />
    

In both cases you will see what values are being evaluated and what is the outcome in jmeter.log file

JMeter Log File - If Controller - Debug

See How to Configure JMeter Logging article for more information.


Individual JMeter properties and variables names/values can be visualised via Debug Sampler and View Results Tree listener combination.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.