0
votes

I am trying to implement a logic where i do not want to send HTTP Requests unless an API returns 0 for a field. If i send the requests without monitoring response from this API, my test is invalid. API returns response in JSON, i can parse and extract the data i need to compare.

Below is my test structure Thread Group - CSV Data Set Config - HTTP Request - JSON Path Assertion

I want to call this API after every minute and proceed with sending HTTP Requests when field value is 0. I don't want to check before every HTTP Request just once before sending the first request.

Should i use If-controller and JSR223 preprocessor (for invoking API, parsing JSON etc) but pre-processor will be invoked before every request which is too much overhead and not required. Please let me know if you have any suggestions. I will appreciate any help.

1

1 Answers

1
votes

Re-design your plan as follows:

  • Thread Group

    • While Controller

    • While Controller Condition: ${__javaScript("${somevar}" != "0",)}

    • Constant Throughput Timer: Target Throughput - 1.0