Search code examples
jmeterjmeter-pluginsjmeter-5.0jmeter-maven-plugin

Jmeter - Incorrect Response due to query parameters encoding


In Jmeter I created a simple GET request having query params as below

https://xxxx.com/salsvc/api/Compensation?employeeId=TestEmp1

But in listener response I get No Item found

Whereas if I run the same request through POSTMAN , it gives me the correct expected result

"data": [ { "frequency": "Single", "ItemName": "Basic Salary", "employeeId": "TestEmp1", "ItemId": 1 } ]

Even if I create request by importing CURL from POSTMAN , I get incorrect result.

I tried using JMETER function like encoding/decoding but no success .

I think something is incorrect with the way my query params are being treated in Jmeter . Any help will be much appreciated

enter image description here


Solution

  • Try specifying your parameters in URL query string directly:

    enter image description here

    In general if your request works in cURL or Postman you can:

    • In case of cURL there is an option to create a request from the command:

      enter image description here

    • Both cURL and Postman requests can be converted into JMeter by simply record it using HTTP(S) Test Script Recorder. You can configure cURL to use JMeter as the proxy via -x command line argument.

      Postman also supports upstream proxies, in case of HTTPS you will need to import JMeter's certificate into Postman first

      enter image description here

    See How to Convert Your Postman API Tests to JMeter for Scaling article for more details if needed.