Jmeter – If controller example

If controller  example to control which request to send based on response of the other sampler.

We’re using Dummy Sampler to generate requests.

We also need to extract response’s code. We can use Regular Expression Extractor to get it:

  • Field to check: Response Code
  • Reference Name: RESPONSE_CODE
  • Regular Expression: (\d+)
  • Template $1$

First If Controller Condition

  • ${RESPONSE_CODE}!="200"

Second If Controller Condition

  •  ${RESPONSE_CODE}=="200"

Setup Dummy Sampler to return code 200.

Dummy Sampler - 200

Result:

if controller - yes condition

And now edit it to return something other than 200

Dummy Sampler - 404

Result:

If Controller result

 

Advertisements
Jmeter – If controller example

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s