tjodox
tjodox

Reputation: 121

Using cookie values in HTTP request post body with JMeter

I'm having a problem similar to the one in this post: JMeter; session cookie, but approached from a different angle.

The similarity is at the bottom of the post, where the OP writes:

How... can I set and submit a unique cookie for each user whose value is extracted from the first Response Header?

We're using JMeter for load testing, and need to have several users logged in to our email client at once. The way our website (and test plan) works is:

The problem is that the auth token is not getting stored as a value in such a way that it can be used in a POST request (and because the auth token is not sent as a cookie, we can't simply store it and send it with an HTTP Cookie Manager). The cookie is initially set like this:

AUTH_TOKEN=(long string of letters, numbers, and underscores); Domain=.ourdomain.net; Path=/

We've tried the following to extract the auth token value from the cookie:

I've read through a number of threads but none have dealt with this specific issue. I just started learning how to use JMeter a few weeks ago, so I'm not sure what to do here, and any help would be greatly appreciated. Thanks!

Upvotes: 4

Views: 13512

Answers (1)

tjodox
tjodox

Reputation: 121

The problem was actually being caused by an incorrect request being sent to the server, to which it was then sending a blank response. Once we tore down and rewrote the entire test plan (what we were using was actually a modified version of another test plan) and had CookieManager.save.cookies=true in user.properties, we were able to use ${COOKIE_AUTH_TOKEN} and get the correct value.

Upvotes: 6

Related Questions