Over the years of my experience as a performance testing professional, I have come across many scenarios where performance testing leaves a visual impact on the revenue. Banking, online wallets, tourism, e-commerce are the domains which are mostly concerned about performance as the revenue directly affects end-users trust and site scalability.
Why performance testing is important: What is measurable can be improved
In order to attain accurate performance results, the accuracy of load test results is important. Load-runner, JMeter, Neo-load and IBM Rational Performance Tester (RPT) are few well-known names in the performance industry.
Performance script should be able to handle two major parameters, which are:
- A Large number of Concurrent User Load 2) Dynamic variables
Correlation is used to capture dynamic values in testing. In this article, we will focus on how can we handle dynamic variables using correlation.
We needed to use Correlation to handle the dynamic session id value and re-use it on other APIs as a request parameter – for a client. This also included keeping an eye on its pattern. Based on my experience, before starting to create a script of performance project. It is required to break down the largest test script into smaller test subset. It is better to have the correlation subset atomic. It is very difficult to identify and set every dynamic variable’s value manually. also, it’s very time-consuming. Atomic correlation handling is the best way to handle dynamic variables.
Handle Correlation by JMeter:
By using Regular Expression extractors and BeanShellPostProcessor JMeter can provide support to handle dynamic variables. With the help of regex site, we can accurately identify your regular expression. Observing your response of dynamic variable on resultant tree Listener and Identify the dynamic part, copy the response to the regex site and create your regular expression match for the dynamic value. Add debug Listener to get to know the expression is working or not. Jmeter also provides grouping on regular expression where divide a dynamic variable into groups and use the group value as a reference when a dynamic variable made of multiple sets of value. For example, if the session id is made of userkey+Userfirstname+Sitename then we can create three groups value from regular expression and a group can pass it as a reference into the API request.
While working on IBM Rational Performance Tester (RPT) we found the solution for the atomic correlation.
How does Atomic Correlation work in RPT?
By default, IBM RPT handling atomic correlation while recording an HTTP script. test API response has a reference value that can be used by a subsequent value in the test API request. Test generator detects a dynamic request value which is substituted from a previous value and correlates with the request value. So, if an API has session id then the value is correlated the session id value and assign to a reference variable and that reference variable assign to another APIs’ which refers to the session id.
How to Identify Correlation in RPT?
You can identify Related data pool variables on the test data table(in green color )and references (in blue text). So, you need to focus on just green and blue colored variables only to handle correlation and verify selected references.
We can associate correlated data with a data pool from the Data Source window:
table row > substitute > select Data Source > Data Source window.
You can also use the Test Data Sources view to make substitutions:
Test editor > Test Data table >select Link with Test Data Sources View > click on the row in the Test Data table > Information about selected substitutions.
Sometimes, substitutions information requires custom changes as per API structure of the performance project for that you need to turn off auto-correlation for RPT from the following path:
Click Window > Preferences > expand Test > Test Generation > turn off the toggle.
Please note, on binary data response, auto-correlation is not supported.
As a performance Tester, I knew the importance to identify the dynamic variable and choose your correlation value wisely to enhance performance testing script strength. Remember 100% atomic correlation is not always possible but it helps to create performance script faster by reducing the effort to identify the dynamic variable and create the exact regular expression value.