Dealing with dynamic boundaries in LoadRunner using Text Flags
When we talk about LoadRunner, we generally hear the term *Correlation (which is nothing but capturing dynamic data from the server response to be used as input in further requests*). LoadRunner is good at auto-correlation capabilities, but sometimes we come across situations, where only your scripting capabilities and the correct use of some advanced features can help
We generally talk about dynamic data, *but what if the strings by which that dynamic data is bound, are themselves dynamic*. To put it simply, *what if the left and right boundaries of the string to be captured are dynamic?* For complex changes, we first capture a subset of the server response, based on some unique boundaries identified, and then with the aid of custom-built string handling functions, we get the desired substring out of the captured string. I will discuss that approach in a separate article.
Suppose you have the response data as follows, where Captured is the string you want to capture, but issue is that the left boundary is changing every time. You get the left boundary as axb, where x ranges between 0 and 9, as follows:
a0b=Capturedrb a1b=Capturedrb a2b=Capturedrb ——– ——–
a9b=Capturedrb
You can capture the desired string by putting the following correlation function in place, using the */DIG text flag* in combination with LB:
*web_reg_save_param(“DynamicCapture”, “LB/DIG=a#b\=”, “RB=rb”, LAST);*
The corresponding place, which you expect to be dynamically filled in with a digit, should be replaced by a pound sign ( # ).
*If letters are changing case*, you can modify the function as below to include the /IC flag:
*web_reg_save_param(“DynamicCapture”, “LB/IC/DIG=a#b\=”, “RB/IC=rb”, LAST);*
Extending the argument further, if there are multiple digits, you have to put a pound sign (#) sing for each digit:
A0123b=”Captured”rb
web_reg_save_param(“DynamicCapture”, “LB/IC/DIG=a####b\=”, “RB/IC=rb”, LAST);
Till now we were discussing about dynamic digits. If you find a case, where you expect a place to be filled in dynamically by a digit or a letter, then modify the function to use /ALNUM instead of /DIG text flag, and use caret sign(^) instead of # :
web_reg_save_param(“DynamicCapture”, “LB/ALNUM=a^b\=”, “RB/IC=rb”, LAST);
To deal with the case while, matching alphanumeric dynamic boundaries, there are three versions of /ALNUM flag as – ALNUMIC to ignore case, ALNUMLC to match only lower case, and ALNUMUC to match only upper case. In the above example, ALNUMIC has been used.
So, go back experiment! But while you do that, keep in mind two things: 1.One sign (# or ^) for each place
2.If you have a literal # or ^ sign, it will not be interpreted as a literal, if you use the corresponding flags. E.g. LB/DIG=a#b will not match “a#b”.
*web_reg_save_param(“DynamicCapture”, “LB/DIG=a#b\=”, “RB=rb”, LAST);*
The corresponding place, which you expect to be dynamically filled in with a digit, should be replaced by a pound sign ( # ).
*If letters are changing case*, you can modify the function as below to include the /IC flag:
*web_reg_save_param(“DynamicCapture”, “LB/IC/DIG=a#b\=”, “RB/IC=rb”, LAST);*
Extending the argument further, if there are multiple digits, you have to put a pound sign (#) sing for each digit:
A0123b=”Captured”rb
web_reg_save_param(“DynamicCapture”, “LB/IC/DIG=a####b\=”, “RB/IC=rb”, LAST);
Till now we were discussing about dynamic digits. If you find a case, where you expect a place to be filled in dynamically by a digit or a letter, then modify the function to use /ALNUM instead of /DIG text flag, and use caret sign(^) instead of # :
web_reg_save_param(“DynamicCapture”, “LB/ALNUM=a^b\=”, “RB/IC=rb”, LAST);
To deal with the case while, matching alphanumeric dynamic boundaries, there are three versions of /ALNUM flag as – ALNUMIC to ignore case, ALNUMLC to match only lower case, and ALNUMUC to match only upper case. In the above example, ALNUMIC has been used.
So, go back experiment! But while you do that, keep in mind two things: 1.One sign (# or ^) for each place
2.If you have a literal # or ^ sign, it will not be interpreted as a literal, if you use the corresponding flags. E.g. LB/DIG=a#b will not match “a#b”.
LoadRunner Training in Bangalore
LoadRunner Training in Hyderabad
LoadRunner Online Training
LoadRunner Training in BTM
LoadRunner Training in Marathahalli
Best LoadRunner Training Institutes in Bangalore
Best LoadRunner Training Institutes in India
Training Institutes in Bangalore
No comments:
Post a Comment