Reputation: 4430
I'm generating http requests in JMeter using CSV dataset. I'd like to generate nested json like the following one:
{
"name": "some_name",
"from": {
"lat": 20.1,
"lng": 32.5
}
"to": {
"lat": 41.2,
"lng": 54.8
}
}
I parametrized http sampler request body looks as follows in JMeter:
{
"name": "${name}",
"from": {
"lat": ${from_lat},
"lng": ${from_lng}
}
"to": {
"lat": ${to_lat},
"lng": ${to_lng}
}
}
Test data set is as follows:
name,from_lat,from_lng,to_lat,to_lng
some_name,20.1,32.5,41.2,54.8
Instead of required json JMeter compose the following:
{
"name": "some_name",
"from": {
"lat": ${from_lat},
"lng": ${from_lng}
}
"to": {
"lat": ${to_lat},
"lng": ${to_lng}
}
}
What do I need to do to make JMeter substitute the from_lat,from_lng,to_lat,to_lng
parameters?
Upvotes: 4
Views: 2411
Reputation: 611
Make sure you set ignore first line only set to true , as you are adding column names in the dataset,
here is my CSV config file settings
You can refer this blog
For more info on CSV config Follow this link
Upvotes: 2
Reputation: 168157
Provide full path to your CSV file (or relative to current JMeter working directory)
No extra configuration should be required.
Verify that JMeter substitutes variables with actual values from CSV using View Results Tree listener
More information: Using CSV DATA SET CONFIG
If something goes wrong check out jmeter.log file, normally it should contain enough information to get to the bottom of the issue
Upvotes: 1