Get Knowledge from Video instead of Content:

Monday, 30 January 2017

JMeter - PreProcessor - "HTTP URL Re-writing Modifier"

As we had seen that HTML Link Parser PreProcessor extracts all the HTML links from the response of the previous request and then passes the random link to the successive request (under which HTML Link Parser is added as a child element). "HTTP URL Re-writing Modifier" works similarly to the HTML Link Parser, except it has a specific purpose for which it is easier to use than the HTML Link Parser and more efficient. For stateless HTTP protocol and Web Servers, the use of URL Re-writing is to store session ids instead of cookies and add them to every request of that ThreadGroup, under which this element is attached. Also, this modifier can be attached to select requests and it will modify only them. As we know that the HTTP protocol and Web Servers are stateless. This means that every request and response are independent, and can’t be identified by a previous request. But we need to know if a request is coming from the same user as their previous requests, and we need to be able to properly process all requests that come from the same user. 

Let's try to understand this scenario with an example. I want to recharge my mobile without login to my telecom vendor application, so I just select "Postpaid", enter the mobile number and click "Go".
In the next page, I will fill the amount and click "Proceed". You can see that I did not log in to the application.

On proceeding, I moved to the payment page where I can complete the bill payment.
Now, in the whole scenario, user session played an important role. All actions by the same user from the same client (whether by the browser or mobile app) are the same Session. So the session data needs to be passed between the server and client in every request and response. One of the approaches to storing this session is URL Rewriting. In URL Rewriting, the session ID is added to each URL, and it will be received on the server side and processed accordingly. This enables the server to process complete sessions. However, if we navigate through the website with JMeter, the test will fail, since no session information was provided to the requests.


How to add "HTTP URL Re-writing Modifier" element?
You can follow below steps:
1. Select the "Thread Group", "Controller" or "Sampler" node (from where you want to capture the value).
2. Right-click on the node
3. Mouse hovers "Add"
4. Mouse hovers "PreProcessor"
5. Click "HTTP URL Re-writing Modifier"

How to remove "HTTP URL Re-writing Modifier" element?
You can follow the below steps:
1. Select "HTTP URL Re-writing Modifier" node
2. Right click on "HTTP URL Re-writing Modifier" node
3. Click "Remove" (Mouse) or "Delete" button from the keyboard
4. Click "Yes"    

What are the attributes of "HTTP URL Re-writing Modifier" element?

"HTTP URL Re-writing Modifier" has following attributes:
  • Name: To provide the name of the preprocessor
  • Comments: To provide arbitrary comments (if any)
  • Session Argument Name: The name of the parameter to grab from the previous response. This modifier will find the parameter anywhere it exists on the page, and grab the value assigned to it, whether it's in an HREF or a form. This is a mandatory attribute.
  • Path Extension: Some web apps rewrite URLs by appending a semi-colon plus the session id parameter. Check this box if that is so. This is an optional attribute.
  • Do not use equals in path extensionSome web apps rewrite URLs without using " = " sign between the parameter name and value. This is an optional attribute.
  • Do not use questionmark in path extension: Prevents the query string to end up in the path extension.
  • Cache Session Id?: Should the value of the session Id be saved for later use when the session Id is not present? This is a mandatory attribute.
  • URL Encode: URL Encode value when writing parameter. This is an optional attribute.
Next Topic:
Apache JMeter - "JDBC PreProcessor" Element

Previous Topic:
Apache JMeter - "HTML Link Parser Pre-Processor" Element

Related Topics:

No comments :

Post a Comment