I m newbie in JMeter. I am trying to send multiple JSON request using Jmeter where.
Login (getToken) Request - I m loading a csv file for username and password
{ "Username": "${Username}", "Password": "${Password}",
}
Response
{"Status":"Success","HttpStatus":200,"Data":{"token_type":"Bearer","token":"eITWDFHzN-awdaJy5SQ","name":"JMeter","u_ID":"6934FF18C130"}}
for this I have request like this
{
"Comment":"TEST COMMENT",
"Type":"TEST",
"DATE":"04-02-2020",
"ColA":"",
"ColB":"",
"ColC":"",
"ColD":"",
"ColE":"",
"User":"${name}"
}
Here no of columns are diffrent. So I want to set up a plan where i want to read request JSON from the file. I tried with storing diffrent request in CSV file but JMeter is not able to read it.
I found if you storethe request in CSV file then it is adding extra " " like below.
JMeter request
POST data:
""{""Comment"":""TEST COMMENT"""
[no cookies]
Which is best way to handle/ ready JSON request from the file
Use __eval() and __FileToString() functions combination directly in "Body Data" tab of the HTTP Request sampler like:
${__eval(${__FileToString(/path/to/your/file.json,,)})}
where:
__FileToString()
- loads file from disk eval()
- evaluates eventual JMeter Functions and Variables to resolve their values, ie ${name}
Demo:
More information: Here's What to Do to Combine Multiple JMeter Variables
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.