3
votes

I have a JMeter load test script with a thread group and a Cookie Manager.

The users in the thread group first log in using a HTTP sampler to obtain a cookie.

Then a loop controller fires an interleave sampler which alternates between a couple HTTP samplers that fire off queries to the server.

Now I'd like one of the options of the interleave controller to fire two or three concurrent requests for the same user, sending the same cookie in each request.
How can I do this?

2

2 Answers

2
votes

If you need to download resources of a page concurrently then there are checkboxes for this at bottom of http sampler gui. But i think you already know that so what you did seems fine.

A variation better for performances would be to use Groovy + JSR223 (adding cache key so that compilation occurs only once).

Was it to simulate Ajax calls or something else ?

1
votes

What we ended up doing:

  • A beanshell sampler retrieves the sessionID cookie value from the cookie manager after the login request and sets it in a variable.
  • Another beanshell sampler is added as a child to the interleave sampler. This beanshell sampler retrieves the cookie from the variable. It then starts a new thread for each request, which fires the HTTP request using the cookie value, and checks the result. The original beanshell thread joins all the started threads and combines the results.

This was rather cumbersome to code. Can you think of a better way to do it?