Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jmeter - get parameter from redirect URL

Tags:

jmeter

I'm trying to write performance test.

In a step #1 I'm visiting url: https://example.com/login?redirect_to=http://somesite.com

This url redirects me back to http://somesite.com?ticket=afsgdfasdfasg

In my JMeter script I need to extract ticket parameter and reuse it in a further logic.

Could you please tell me how it can be achieved ?

like image 926
alexanoid Avatar asked Mar 02 '16 08:03

alexanoid


People also ask

What is follow redirects in JMeter?

When you check Redirect Automatically option, JMeter will not consider redirect as separate HTTP request. This in turn may result as lower response time in your overall performance test. Whereas Follow Redirect option will consider each redirection as separate requests.

How do I stop a redirection in JMeter?

Follow Redirects (checkbox). Uncheck these two check boxes to disable the redirects. You can then include a separate HTTP sampler to perform the redirects if you want by checking the status of the previous request. I face this situation in my projects and this is the technique I use to control redirects.

In which tab of view results tree the dynamic value for the response headers can be captured?

Step 5: Under 'Response Data' tab, click 'Response Header' or 'Response Body' tab (wherever dynamic value is present).


1 Answers

  1. Add PostProcessor => Regular Expression Extractor;
  2. That would look like this: RegEx

  3. Further reference this variable as ${ticket}

Good luck!

like image 79
Olha Horak Avatar answered Oct 06 '22 04:10

Olha Horak