tony2tones
tony2tones

Reputation: 1670

Jmeter with CSV data: How to make a get post where Parameter is in the String not at the end

I'm using Jmeter for load testing done. I have successfully added a CSV data where i need to login with different users, that works fine, the CSV data is added to the end of the call.

Now I would like to make another call with CSV data, which contains a list of IDs. I need to make multiple GET calls with different IDs from that CSV file.

I have tried GET: api/Companies/${companyId}/random/request Unfortunately this doesn't work cause it still adds the CSV data item at the end of the call instead of inside the string request.

How to I add a parameter from a CSV file into the Request String is my question? I've tried {companyId} and ${companyId}

Please advise.

Upvotes: 0

Views: 648

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

Your api/Companies/${companyId}/random/request request should work fine

enter image description here

If it doesn't - check jmeter.log file, if JMeter cannot open the CSV file - you should see a message there. Also double check your CSV Data Set Config setup and ensure that the variable can be seen using Debug Sampler and View Results Tree listener combination.


If you don't have too many IDs in the CSV file and it's the only column there you can consider using __StringFromFile() function instead of using the CSV Data Set Config like:

api/Companies/${__StringFromFile(test.csv)}/random/request

replace test.csv with the relative (or full) path to your CSV file

enter image description here

Check out Apache JMeter Functions - An Introduction to learn more about JMeter Functions concept, where and how they can be used, etc.

Upvotes: 1

Related Questions