0
votes

I have a threadgroup with 100 thread (users), and loop count of 10. I have a cookie manger with default setting. The users are anonymous (not logged in), but I want to track the number of users hitting the site in application insights, as it will generate new .net session tokens.

When I run the test, i would expect cookies to be local to each threads loop iteration.

So I would expect cookies to be "cleared" on each thread 10 times, and so I would expect to generate 1,000 .net session cookies on my application.

however, I don't, I see 1.

In the cookie manager, there are two options:

  1. Clear cookies each iteration
  2. Use thread group configuration to control cookie clearing.

Both are unchecked.

But this makes no sense - I want the cookies to be cleared on each iteration for each user.

Should I check one or both of these? do I need to set anything on the thread group?

In the thread group, I have "user same user on each iteration" unchecked - each iteration should be considered a new user.

Also, does it mater where the cookie manger goes? I have always put it at the top, above the threadgroup, but perhaps it is supposed to go under the thread group?

Ideas?

3

3 Answers

1
votes
  • 100 * 10 gives 1000, not 10000

  • There are 2 ways on how you can clear the cookies each iteration:

    1. Tick this box:

      enter image description here

    2. Or tick the other and untick Same user on each iteration on Thread Group level

      enter image description here

    I would go for the latter option as this allows controlling i.e. HTTP Cache Manager and HTTP Authorization Manager as well

  • HTTP Cookie Manager considers only Thread Group iteration as iteration, other loop sources like Loop Controller or While Controller are not taken into consideration

  • You might consider placing your HTTP Cookie Manager(s) in order to limit its(their) scope according to your test scenario

1
votes

You can add to first request JSR223 PreProcessor with code that will clear cookies on each start of iteration

sampler.getCookieManager().clear()
0
votes

I did some experimentation. I got the right results after doing this:

  1. put the cookie manager under the threadgroup. Before I had it above.
  2. set "Use thread group config to control cookie clearing" in cookie manger
  3. In threadgroup, make sure "use same user on each iteration" was unchecked.

Now for each thread, and each iteration, i see new session cookies, and these are preserved just for that thread and iteration.