Reputation: 1
I'm testing a standalone java application using JMeter and I'm using a OS Process Sampler to execute the jar file. I've given JSON string in java program and I've used publish method to post JSON string to Queue. Now I want to capture the data in JMeter response data and I want to do parameterisation for those fields and I want to use CSV Data Set Config to pass the values to fields and each user should take unique data.
The JSON string looks like below and I want to parameterise these valuse from JMeter response data and pass values from CSV file.
[{
"id": 100001,
"status": "Pending",
"priorityCode": "1",
"miniTeamId": "234256",
"requestName": "General"
}]
Upvotes: 0
Views: 1539
Reputation: 168217
Given your CSV file looks like:
100001,Pending,1,234256,General
100002,Done,2,234257,General
etc.
Configure your CSV Data Set config as follows:
Variable Names: id,status,priorityCode,miniTeamId,requestName
other fields can be left as they are. By default JMeter will read next line from CSV file by each thread on each loop, when file end will be reached - JMeter will start over.
JMeter Variables populated by the CSV Data Set Config can be referred as ${variableName}
or ${__V(variableName)}
so parametrised request body should look like:
[
{
"id": ${id},
"status": "${status}",
"priorityCode": "${priorityCode}",
"miniTeamId": "${miniTeamId}",
"requestName": "${requestName}"
}
]
See Using CSV DATA SET CONFIG for more detailed information on parametrisation of JMeter tests using CSV files.
Also be aware of the following test elements:
UPD: passing parametrized JSON string via OS Process Sampler
Upvotes: 1