Bert
Bert

Reputation: 377

JMeter redirection URL

I'm trying to stress test a website where people are able to create reports which are stored in SQL, etc... Let's say the page orders are the followings:

As you can see, there is a sub-page called reports. It has a create button. Then the user is being redirected to the create sub-page. When it clicks the save button, it get's redirected straight to its reports sub-page. Now my issue is I don't see the redirection URL that is being received by the browser where to be redirected. Maybe the report ID will be 3 or 4, or 123.... etc. I want this value as a variable. At the create sub-page I have a Response code: 302 but I can't figure out where is it redirecting the user to and where can I modify this URL value.

Upvotes: 2

Views: 6691

Answers (1)

Dmitri T
Dmitri T

Reputation: 168002

When you are being redirected the server sends Location header which indicates where exactly you are being redirected

JMeter Redirect

In order to extract this redirect URL you can add Regular Expression Extractor postprocessor as a child of the main request and configure it like:

  • Apply to: Main sample and sub-samples
  • Field to check: Response headers
  • Reference Name: anything meaningful, i.e. location
  • Regular Expression: Location: (.*)
  • Template: $1$

Assuming everything goes well you should be able to refer the extracted value as ${location} where required.

References:

Upvotes: 4

Related Questions