List

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.

Many a times, the solution can be much simpler. If you come across dynamic boundaries like the following, then instead of doing lot of string operations, you can use text flags in LoadRunner.

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”.

Rahul Verma

www.testingperspective.com

21 Responses to “Dealing with dynamic boundaries in LoadRunner using Text Flags”

  1. Lakshmi

    Really helping information, that too precise.

    Thank you so much Rahul.

    Thanks
    Lakshmi

  2. Rahul Verma

    This one is from the days when I used to work with the LoadRunner tool and then moved on to desktop products in security domain.

    I’m pleased to see it still helps :-)

    • Rajendra

      Hi Rahul,
      I am looking to continue my carrier in Security testing from Performance any suggestions/comments.
      Kindly email me the details.

      Regards,
      Rajendra

  3. Anil

    Hai,
    If i have more than single digit instance how should i handle the dynamic left boundary
    because flags only taking till 9 digit
    example:SKU0,SKU2,SKU3,SKU4,SKU5,SKU6,SKU7,SKU8,SKU9,SKU10,SKU11,SKU12

  4. Shivv

    I might be wrong, we cant handle this by writing LB/DIG=SKU# as this cant handle double digits ans as well we cant use LB/DIG=SKU##.
    I suggest to write two web_reg_save_param statements handling the situation.

  5. charu

    Hi,
    what if my left boundry does not have same length. say we have LB as below:
    ABC R12 net
    ABC RR1212 net
    ABC RT13M net
    ABC TTy1GM net

    I suppose I can not use ABC^^^^^^^^^^^^net here

  6. piyush gupta

    first correlate left boundaries :
    web_reg_save_param(“dyanamic “,LB=”ABC”,RB=”net”,LAST);
    AND THEN USE IT AS LEFT BOUNDARY………
    IT IS “ABC{dynamic}net”……….

  7. Monica

    Hi Piyush,
    I tried correlating left boundary first but it is going error message saying that “Check whether the requested boundaries exist in the response data”.
    // “edit.net123″
    web_reg_save_param(“Corr01″,”LB=”edit.”,”RB=” “,”Ord=1″,”NotFound=Warning”,LAST);

    //”Edit Block net123/11
    //need to extract value 11
    web_reg_save_param(“Corr02″,”LB=”Edit Block {Corr01}/”,”RB= “,”,”Ord=1″,”NotFound=Warning”,LAST);

    Can you please help me.

  8. Raja Sekhar

    Hi,

    This is in continuation to what is posted by Charu & Piyush. Charu’s requirement can be refined as follows:
    I have a situation where the left boundary (or the right – whatever) is changing dynamically both in terms of length and also the content of the string like:

    pqrst>123 Rahulabcd Khan1a2b3c Amarda1p2q3r Sonu968klmo0098 Rahul”, “RB= ” ( I mean to say there is a space between 123 & Rahul). Next, use another web_reg_save_param to capture the names Rahul, Khan etc, and then use the “Capture_1″ as the LB for this function. Like web_reg_save_param(“Capture_2″, “LB={Capture_1}”, “RB=<", LAST);

    My question is: "Will this work" or throw errors ? or do we need to use strok function vastly ?

    Please let me know.

  9. vv

    if LB and RB are changing every time,How can we correlate in that case?

  10. swetha

    its very useful

  11. venkat

    How to handle, If there is no Left or Right Boundary

    • Rahul Verma

      @Venkat,

      Defining LB/RB is the basis of how it works in LoadRunner as it does no support Regular expression based parsing. I’m also not sure how you don’t have an LB/RB while extracting a small part of data from an HTML response.

  12. selva

    Experts,

    Please anyone explain with one small example.

  13. uttam

    if i dont have L.B and R.B how to handle it?

  14. Sri

    Very informative…. Thanks..!!

  15. Mishal

    Hi,
    I have a problem. I’m trying to correlate a particular string from a particular web application and the left boundary has a dynamic value.Also it is of no fixed size; it varies from 2-5 characters.
    I have tried using TEXT FLAGS, but still the problem is UNSOLVED as it’s throwing an error. How to handle this situation?

  16. Shiva

    How to handle dyanamic data for afrloo,ctrlstate,afrwindow id for oracle ADF technologty

  17. raju

    How to capture second occurrence when LB and RB are empty?

  18. Vamsi

    hi Rahul,

    Thanks for giving useful information
    and what if my left boundary does not have same length. say we have LB as below:
    ABC R12 net
    ABC RR1212 net
    ABC RT13M net
    ABC TTy1GM net

    I suppose I can not use ABC^^^^^^^^^^^^net here

  19. skhosand

    How to correlate this variable pB9NU*_Ez8_Z7WcMzf_g_A the asterisks is not on the request side

Leave a Reply

Your email address will not be published. Required fields are marked *