(This post is written by Yang Luo (Kert) from the LoadRunner R & R Team)
Load testing Scenarios in HP LoadRunner consist of scripts created by a Virtual User Generator (Vugen), which can used To record the web/http traffic sent to and from an application. When a recorded script was played back without modification, there was often errors, and the script can ' t be played back as -is. This May is due to values which is sent by the application ' s server to the client, and which is different each time the Script is run. For example, session IDs is used to identify the specific session currently in play. When the traffic was recorded, the session ID is also recorded; But when it's played back, the recorded session ID was no longer valid, resulting in the script failing to run.
To resolve this problem, LoadRunner introduced the concept of correlation. This identifies these instance-specific values, and replaces the occurrences of the values with a parameter whose value is Set once each time the script was run, and is used throughout the script. Correlation can performed manually, but this is time-consuming and error-prone, so LoadRunner comes with a number of FE Atures that automatically identify session-specific values and automatically correlates them. This auto-correlation was pretty reliable, but isn't foolproof, so it's some tips that can help you.
If you aren ' t currently using LoadRunner, this is your opportunity to experience the capabilities it ...
1) Disable ' Record Scan '
If your script is large and it takes a long time to scan for correlation, consider disabling ' Record scan ' in the Recordin G Options Dialog.
' Record-based Correlation ' uses some heuristic methods to find a Correlation. However, if your script is very large, or there is too many complex parameters, it'll take too much time to try Differe NT combinations. Disabling it can significantly reduce the waiting time.
The downside of disabling this option are you would have to define some rules to find the correlation for the ' Rules scan ', Or play the script several times to complete the ' replay scan '. So if ' Record Scan ' is working for you, or you have the time to wait, it's still best to keep it enabled.
2) Use Regular Expressions for formatted Strings
Where possible, use regular expression (regexp)-based correlation rules for formatted dynamic strings, such as UUIDs, whic H consists of a set pattern of hexadecimal digits
Some dynamic values do not have a unique boundaries, which makes boundary-based rules inefficient. However, they may has a set format, in this case, a regular expression can help to find them more accurately:
3) manually correlate short Strings
When you had very short dynamic strings, such as "? q=a&page=2" and use manual correlation.
Vugen usually ignores very short values while scanning for correlation in order to save time and avoid false positives. You can enable them if your wish, but that'll impact the performance and the accuracy of the correlation scan results, so It ' s best to manually correlate short values.
4) Customize the Correlation Rules
Vugen ' s Design Studio automatically creates correlation rules, but can customize them for your specific situation BEFO Re using them.
In the Design Studio, you can generate a correlation rule from a displayed correlation result. To get a better correlation result next time, you can modify the generated rule based on your application by extending the boundaries, adding filters to XPaths, and supplying format-specific info in regular expressions etc.
For example, the automatically generated regexp-based rule for the GUIDs in the screenshot below are very generic, and could Match irrelevant strings. So we can manually the change it to a regular expression, specifically matches a GUID, such as: "\a\{[0-9a-f]{8}-[0-9a-f]{ 4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\}\z ".
5) Extend The Correlation Size Limit for Long Strings
Some strings can is particularly long, such as ViewState values, which can exceed the default length limitation for Correl ation. You can change the length of the limitation in the Recording Options dialog, or correlate that value manually, in which case the Size limit doesn ' t apply. Most dynamic values is not very long, and a shorter length limitation would help to improve performance of scanning. We suggest that's increase it when necessary.
I Hope these tips help you correlate the dynamic values in your scripts. If you aren ' t currently using LoadRunner, you can download it here. You can also visit the HP LoadRunner homepage to learn about additional capabilities it offers.
Feel free to leave us a comment in the box below if you had experience with this or if you had any additional questions.
Thanks to Kert for providing this article!
5 tips to correlate Web HTTP scripts in HP LoadRunner