StresStimulus handles HTTP cookie correlation automatically. Every time a server response contains a Set-Cookie header, StresStimulus acts accordingly and sets the request HTTP cookie value in all subsequent requests. However, in rare instances, the request cookie value is set by some client-side script and can't be automatically correlated. For example, an application can have a client script that, after every click, sets a timeout cookie to a few minutes into the future to monitor user inactivity. While load testing such a test case, the recorded value of this cookie can't be used because the server will think the VU is inactive. In these cases, you can use the Set-Cookie object to parameterize the cookie value manually.

To use the set-cookie object:

  1. Select the object where you want to insert the set-cookie object. The value of the cookie will be set at that time during the test case execution.
  2. Right-click and select Insert Object -> Insert Set-Cookie (3), then select Insert Before, Insert After, or Insert Into (4).


In the Set-Cookie property grid, set the following properties.

  1. Set the name of the request HTTP cookie.
  2. Set the expression that will be evaluated to determine the value of the cookie. The expression can be a combination of constant text and variable. The variable can be chosen from the variable picker in the property grid. Press the down arrow (a) to bring up the variable picker.

    Deleting the cookie

    To remove the HTTP cookie from the request, clear the Value property.

  3. Set the Domain (host) that the cookie belongs to and the Path that the cookie belongs to (the default path is "/" which means all pages in the domain). 


    The HTTP request cookie will only be added to requests that match the given host and the request URL is in the given path.

Persistent request cookies

The Set-Cookie object emulates a Set-cookie HTTP response header that is described here. A subsequent Set-cookie HTTP response cookie will override the value from the previous header and the previous Set-Cookie object. To prevent using the new value, set the Is Persistent property to Yes.

Clearing the Affinity cookie

One example of when this would be helpful in clearing the affinity cookies (these cookies are used to route requests to a single server behind a load balancer). Typically, if the affinity cookie is missing in the request, the server will create a new one and send it in the Set-cookie response header. To permanently clear the affinity cookie from all requests, add a Set-Cookie object, clear the Value property, and set the Is Persistent property to Yes. See the example below.

  • No labels