Reputation:
I am having a endpoint which accepts a auto-increment integer id as part of path param and in request body also there are some keys which accepts that as well.
For example endpoint is http://foo.bar/{id}
And body is
{
"someid" : someno+{id passed in url},
"some world :"fixed string" + "id passed in url"
}
I tried using __counter()
directly in place of my {id}, but its not working and in when debugging found that its not replacing the value and its coming as literal only.
Upvotes: 5
Views: 6293
Reputation: 21587
4 years passed, I jmeter changed a little, so let me give another detailed answer:
1.create a test plan
2.create a thread group under this test plan
3.create a http request under this "thread group"
4.under this "http request", create a "loop controller"
5.under this "loop controller", create a "counter"
6.run this thread group, and check your web app log:
Upvotes: 0
Reputation: 168197
There is __counter() function which is generating an incremented number each time it's being called, you can put its declaration into the URL like:
${__counter(FALSE,counter)}
and the JMeter Variable reference into the request body:
{
"someid" : someno+${counter},
"some world :"fixed string" + "id passed in url"
}
This way you will get an unique incremented number for each call
More information: How to Use a Counter in a JMeter Test
Upvotes: 1