In this article, We will talk about how to handle dynamic data in JMeter which is basically Correlation. Correlation is the important aspect of scripting. Proper handling of dynamic data results in building effective test scripts.
What is Correlation and why is it required ?
Correlation is an act of fetching dynamic data from preceding requests/calls and posting it to the subsequent requests/calls. Lets envision an example to find out why we need correlation. Suppose we have recorded a scenario in which user does the following transactions
- User enters login details and click submit button,
- Home page opens and user take further actions,
- And then Logs out of the system.
Soon after recording if you try to run the script, it may even fail for a single user. This might be because of numerous reasons, lets assume that one of the reason might be authentication mechanism implemented. When a user logged into the system, a unique session is created for user and it will be active until the user logs out of the system. Lets imagine, a unique tokenId is dynamically generated up on user login and is passed to the subsequent requests to validate the user actions. So, one cannot just record and playback the requests having these tokenId’s which are unique for every user sessions. Here, we need to correlate the web requests with the dynamic variables (tokenId). And for correlation, we need to use the “Regular Expression Extractor” which makes use of regular expressions or most commonly known as RegEx.
Continue reading Correlation: Dynamic data handling using Apache JMeter
In this article, we will discuss about the next set of JMeter elements i.e Pre-Processors and Post-Processors. Lets discuss in detail, how do we use these elements to build a effective test scripts . In case if you have missed the older articles click here.
Pre Processor Elements
A Pre-Processor elements executes some action prior to a Sampler Request being made. If a Pre-Processor is attached to a Sampler element, then it will execute just prior to that sampler element running. A Pre-Processor is most often used to modify the settings of a Sample Request just before it runs, or to update variables that aren’t extracted from response text.
Post Processor Elements
A Post-Processor elements executes some action after a Sampler Request has been made. If a Post-Processor is attached to a Sampler element, then it will execute just after that sampler element runs. A Post-Processor is most often used to process the response data, often to extract values from it.
Execution order of the Elements:
Lets understand in which order JMeter process the elements when multiple elements are added to the thread group.
Please note that Timers, Assertions, Pre- and Post-Processors are only processed if there is a sampler to which they apply. Logic Controllers and Samplers are processed in the order in which they appear in the tree. Other test elements are processed according to the scope in which they are found, and the type of test element.
Continue reading JMeter Complete Element Reference– Part VI