Re: API used for correlation - practical difference (402 Views)
Reply
Occasional Advisor
Posts: 13
Registered: ‎11-19-2013
Message 1 of 5 (420 Views)

API used for correlation - practical difference

Hi,

 

Can anyone briefly describe me practical differences between web_eg_save_param_regexp and web_reg_save_param_ex APIs used for correlation? I got technical solution form help but the description tells me nothing.

 

Regards.

Valued Contributor
Posts: 57
Registered: ‎08-17-2011
Message 2 of 5 (402 Views)

Re: API used for correlation - practical difference

radekq,

example:

 

sample response:
<nobr>loc=WORKFLOW&did=3478504B4B48694C37387341492B34663859667731673D3D&pdwid=&aid=1&pid=57776573596F6C38476F593D&tid=1|WORKFLOW|100000576||501|100|46|1|Order - 18366197 - New</nobr>

 

 

say you have a landing page in your application which has multiple orders...you want to correlate "did" but the pid,tid values change dynamically.

so in the example below i captured "did" where OrderNumber is 18366197 and the ordernumbers are in a parameter file say {OrderNumber}
you could do a regexp like this, which is the easiest way..

 

web_reg_save_param_regexp(
"ParamName=did",
"RegExp=.*WORKFLOW&did=(\\w+)&.+?{OrderNumber}",
SEARCH_FILTERS,
"Scope=Body",
"RequestUrl=*/ActivityAdmin2.aspx*",
LAST);

 

if you use regexp you have the power to choose a greedy or a lazy match to uniquely capture the value you want.  

 

web_reg_save_param_ex is an extension to what you traditionally have with wrsp. 

 

say if you want to correlate a ViewState, both ex1 and ex2 produce same results. 

 

you could do this ex1:

 

     web_reg_save_param("ViewState",
        "LB=id=\"__VIEWSTATE\" value=\"",
        "RB=\"",
        LAST);

 

you could also do this  ex2:

 

     web_reg_save_param_regexp(
        "ParamName=ViewState",
        "RegExp=.*VIEWSTATE\" value=\"(.*?)\"",
        SEARCH_FILTERS,
        "Scope=Body",
        "RequestUrl=*/default.aspx*",
        LAST);

 

traditional LB and RB will not always work for a complex response. if the value you want to capture is buried deep inside a response; where you cannot possibly have a static LB and RB, thats where you use regexp.

 

 

 

 

Pavankumar
Occasional Advisor
Posts: 13
Registered: ‎11-19-2013
Message 3 of 5 (392 Views)

Re: API used for correlation - practical difference

Thank you for your reply.

 

So please tell me what are the advantages of web_reg_save_param_ex in according to simpler and more flexible web_reg_save_param_regexp. If the web_reg_save_param_ex cannot be used to handle a complex response and deep buried values - for what it is - please give me some advantages or situation where it is better to use it.

HP Expert
Posts: 109
Registered: ‎08-11-2011
Message 4 of 5 (378 Views)

Re: API used for correlation - practical difference

In LoadRunner, regexp was introduced later than ex. RegExp is obviously more powerful than boundary based search. It's also recommanded to use regular expression if posible, it can do anything what ex version can do.

Of course, it also has 2 limitaiton,

1. user must have knowledge of regular expression.

2. a "VERY BAD" regular expression could consume unnecessary CPU time, even make the replay process hang. It's up to customer's skill set and requirement.

Advisor
Posts: 18
Registered: ‎11-22-2013
Message 5 of 5 (368 Views)

Re: API used for correlation - practical difference

web_reg_save_param() (with or without ex() ) is a good deal faster inside loadrunner itself. It may be less flexible, but it's definitely a lot simpler, especially if you're not familiar with regexpes.

It usually also covers about 99% of the correlations. ;-)
---
Discover the y-lib loadrunner support library:
https://github.com/randakar/y-lib
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.