Jmeter if controller with http code

I want to use if the controller in my load testing is jmeter. Test:

  • make a message and return the access token.
  • use this access token to get the following link.

My problem:

I have an access token, and I used the post-assertion-> regex extraction tool and got the access token from its HTTP response. But now I don’t know how to use the if control, and ask it to run the next test only if the HTTP response code is 200. And the second question: can I pass the access token regular expression value to the if-header HTTP manager?

attaches a screenshot of my jmeter. enter image description here

+4
source share
1 answer

Try using the “Answer the question” to process the status of the Request_Access_Token request (success / failure) depending on the response code returned, and then use IfController along with the pre -defined JMeterThread.last_sample_ok jmeter variable - regardless of whether the last sample was fine - true / false.

The scheme will look as follows:

ThreadGroup Request_Access_Token Response Assertion Response Field to Test: Response Code Pattern Matching Rules: Equals Patterns to Test: 200 Regex Extractor // your Access_Token extractor IfController Condition: ${JMeterThread.last_sample_ok} // will be TRUE if Response Assertion above is TRUE (ie response code = 200) HttpRequest // send extracted Access_Token along with request ... 
+4
source

All Articles