Total Pageviews

Tuesday, 8 October 2013

How can we pass cookie from one thread to another in JMeter.

Some time we need to make multiple requests after Login in application in such case we should create test plan as:

1. Create a test plan with two thread groups.
2. First thread group should be SetUP thread group which will run once in starting of the Test Plan run.
3. Add a HTTP request sampler for Login request in first thread group.
4. Add a Bean-Shell Post Processor with the request for getting the cookie from response after making login like:









5. Add a HTTP request sampler in second thread group for target request which we want to hit multiple time.
6.  Add a Bean-Shell Pre Processor with the request so that we can pass cookie value in request like:


Now run the test plan.