1
votes

I call a REST web service with post method with this request:

{
    "id":null,
    "scrollType":0,
}

In JMeter after creating Thread Group and add 10 to Loop Count, I added Http Request.I set protocol and other stuff and body data.

I added JSR223 PostProcessor and i'm using this groovy code to get last id from my response:

vars.put("id_BSH", new groovy.json.JsonSlurper().parse(prev.getResponseData()).get(9).id as String)

Now i want to add id_BSH into next request instead of "id":null, !

How can i do this?

For first request I want to be id = null and in other request i want to be id = ${id_BSH}?

1

1 Answers

1
votes

Use id_BSH variable in your request:

"id":${id_BSH},

You just need to initialize value with null, you can defined it in Test Plan or in a User Defined Variables

User Defined Variables element lets you define an initial set of variables, just as in the Test Plan