user2613603
user2613603

Reputation: 147

How to create multi-request based on last json response in JMeter?

I will get json response from last request, then I will parse the response and get a variable array, then create new request base on each element in that array one by one. I don't know how to implement it.

Upvotes: 1

Views: 612

Answers (2)

Dmitri T
Dmitri T

Reputation: 168072

Use JSON Extractor and ForEach Controller combination. The idea is to have variables like:

var_1=foo
var_2=bar
var_3=baz

So you would be able to iterate them using foreach loop. See Using Regular Expressions in JMeter article to get the overall idea.

Upvotes: 2

Naveen Kumar R B
Naveen Kumar R B

Reputation: 6398

Steps to follow:

  1. Add JSON Extractor (>= 3.0 version) Or JSON Path Extractor (< 3.0 version) plugin, to the HTTP Request sampler, as a child, in which JSON response is received.
  2. Add the JSON Path Expressions to capture the specific values and store it in variable names, say capturedArray. refer JSON Path Syntax.
  3. In later requests, i.e., HTTP Request Samplers, you can retrieve the array value by using the syntax ${capturedArray}

Upvotes: 1

Related Questions