Reputation: 61
Im new to Jmeter and web applications at all, I need some help with a json post.
I have an application with a POST request that sends a json string to save the data that was created/changed.
Here an example of the json code that is sent through the POST request
{"ID":0,"Description":"Test 1"}
With that the first user will create a new registry "Test 1", the second user will create another registry with the same description. I´d like to be able to set the ID and Description info as variables to manipulate them. When the post receive ID 0 is to make a new registry, when It receive an specific ID is to update that registry.
I´m trying to simulate some scenarios that user 1 create, user 2 update or user 1 create, user 2 create different. Things like that.
Upvotes: 0
Views: 376
Reputation: 15370
If your aim is to update the ID and the Description @ run time,
Keep the ID and the Description in a CSV file. (something like below)
0, Test1
0, Test1
1, Test2
Use "CSV Data Set Config" (under Config element) to read the CSV file. update the file name and enter "ID,Description" in the variable names.
Update the JSON as
{"ID":${ID},"Description":"${Description}"}
This approach will read the data from CSV and update the JSOn @ run time and send the request.
first thread / loop will take the first row and second thread will take the second row.
It should work..let me know if anything.
Upvotes: 1