Santana
Santana

Reputation: 399

How to create a test plan with unique header value in JMeter

I'm trying this test plan with two requests suppose to have one header value unique for each test. Here is the structure of my current test plan.

Test plan >
HTTP Request1 details:
    Host: Host1/api
        Resource: method1
        Request Method: POST
        Headers: Tenant:x1
HTTP Request2 details:
    Host: Host2/api
        Resource: method1
        Request Method: POST
        Headers: Tenant:x1

So this test plan is used now to run multiple threads to measure the performance of the POST requests go to two different hosts but this test plan needs to be modified to have same threads (10 concurrent threads) submitted by different x1, x2, x3, ... xn tenants. That means x1 will submit 10 requests, x2 submits 10 requests,.. and so on, in parallel. The rest of the items are same in the test plan.

Please advice if there is a way to achieve this in JMeter?

Upvotes: 0

Views: 439

Answers (1)

sunny_teo
sunny_teo

Reputation: 1999

You can use the below setup.

1.Use CSV data set config for the input of two different value..I have take Host but you can take any like in your case Tenant:X1. So, two column with different values.

2.Then, Under the HTTP sampler add header manager and pass the value like Name:-Tenant and Value:-${CSV_Header_Name}. As you can see in the below Host1:Host1_val1 is added in the request. Host1 is from header manager and its value from CSV.

Now, if I understand you scenario, you need to run X1 10 times in parallel during a thread execution and the header value should remain same for all 10 i.e X1.

To do that, use bzm- Parallel Controller plugin and copy paste your request 10 times. All the 10 request under bzm controller will run parallely with the same header value for a particular thread.

enter image description here

OR, if you need only two request with different header each time it is executed then, remove bzm parallel controller and put only two requests i.e. HTTP1 and HTTP2 as show below.

enter image description here Hope this help.

Upvotes: 0

Related Questions