0

here i'm facing one problem.in My JMeter script i am getting some response like this

{"error":"404","error_description":"The underlying provider failed on Open."}
{"error":"404","error_description":"Model state invalid."}
{"error":"200","error_description":"965458"}

this coming in Response data

So i want to assign only 200 response to my next request that is in another thread group(means next request should only accept 200 other than this it should not. ). i used response assertion and set Response code is 200 so that is not working for me.is there any alternative way to do this stuff please tell me with simple demo.

  • If you are asking about stubbing the response, please check this out - groups.google.com/forum/#!msg/ptgram24/OGr7OAvwRYg/MmWH_R7wDwAJ – Ramnath Dec 5 '17 at 9:06
  • No not about stubbing the response – SQA Dec 6 '17 at 13:13
  • Could you improve the question so your intended workflow gets more clarity? What is it what you try to achieve? Why different thread groups? Example of your jmx? – Ray Oei Dec 6 '17 at 16:06
  • Hi...Ray Oei Here i am using 2 thread group Because one thread group consisting 100 users and other Thread group consisting of 20 users where form 1st thread group 100 Response are generating in that Response most of them 200 and other Response are 300, 404 like this so here i want 2nd Thread group only accept "error: 200" response to process the further step in Test plan is this possible....? please tell me . – SQA Dec 7 '17 at 5:07
  • By Using JSR223 Is these possible that if(error==200) then execute the result . – SQA Dec 7 '17 at 7:43
1
  1. Extract this error value into a JMeter Variable using JSON Extractor configured like:

    • Variable Names: anything meaningful, i.e. error
    • JSON Path Expressions: $.error
  2. Add If Controller after the first sampler and use "${error}" == "200" as the "Condition"
  3. Put your "next" requests under the If Controller

enter image description here

Assuming everything goes well the requests which are If Controller's children will be executed only if error value will be 200.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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