Cosmin
Cosmin

Reputation: 2404

Create JMeter test for multiple test on the same API

I need to use JMeter to test an API and this is only info that I got:

method1() Request details:

method2() Request details:

I started with a HTTP Request sampler added pointing to the api server followed by a HTTP header manager as a child with all the header details, however how do I distinguish those 2 methods? As for each of them I should get a different response.

Upvotes: 2

Views: 945

Answers (2)

Faflok
Faflok

Reputation: 1143

First of all you have to add two HTTP Requests and they should have 'Path' set to method1 and method2 accordingly as you have two request to send.

If headers for that requests are identical then the best way will be to add HTTP Header Manager before the requests and add there all name-value pairs you use. If they are different, then you have at least two ways:

  • simple one - add HTTP Header Manager inside each HTTP Request and add all values there,
  • better for maintenance - add one HTTP Header Manager with common/default values before all requests and inside each request next HTTP Header Managers to add/change values that are different for that particular request.

In a matter of fact I pretty much always use variables as values of header parameters for easier configuration (I can set them in CSV files for each ENV I test) but it isn't necessary if you are checking just two requests on one server. If you will be expanding those tests later it is a good idea to parametrise it some way. At least that works for me.

Upvotes: 1

UBIK LOAD PACK
UBIK LOAD PACK

Reputation: 34566

It will be through the field "Path" of your HTTP Request Sampler:

enter image description here

Upvotes: 2

Related Questions