How to manually do correlation? I will provide a sample to discuss this with net friends. Use web tours (loadrunner) as B/S application to demo this point.
Step1: just emulate scenario about log on in and log out these two basic steps. Before doing record action. We should set web session enabled.
Fig1:
Step 2: record the above business rules two times. We will get two scripts and to check them the difference.
Script1
Action()
{
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
EXTRARES,
"Url=../favicon.ico", "Referer=", ENDITEM,
LAST);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=112615.280680437fHQcztipfDtHffpiQV", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
LAST);
web_submit_data("login.pl_2",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t5.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=112615.280680437fHQcztipfDtHffpiQV", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
"Name=login.x", "Value=62", ENDITEM,
"Name=login.y", "Value=6", ENDITEM,
LAST);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t6.inf",
LAST);
return 0;
}
Script 2:
Action()
{
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_url("favicon.ico",
"URL=http://127.0.0.1:1080/favicon.ico",
"Resource=1",
"Referer=",
LAST);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=112615.286593763fHQcztipiAtVzzzHDtHffpiQcicf", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
LAST);
web_submit_data("login.pl_2",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=112615.286593763fHQcztipiAtVzzzHDtHffpiQcicf", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
"Name=login.x", "Value=62", ENDITEM,
"Name=login.y", "Value=6", ENDITEM,
LAST);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t3.inf",
LAST);
return 0;
}
About how to check the difference we can use the built-in tools in Loadrunner(Tool->Compare with scripts…), then If we find the difference ,we could ignore some elements such as position x,y and snapshot value. What should we focus on is about session info and some others.
Step 3 :
To find the left/right boundary , then complete the web_reg_save_param_ex function at the right positions.
Fig2:
Step 4:[in this step, we should know the function web_reg_save_param_ex postion, when we put the function in a wrong position , we cannot get the result as expected.]
We can complete the scripts which can reply successfully.below is the scripts:
Action()
{
web_reg_save_param_ex(
"ParamName=loginSession",
"LB=userSession value=",
"RB=>",
SEARCH_FILTERS,
LAST);
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_url("favicon.ico",
"URL=http://127.0.0.1:1080/favicon.ico",
"Resource=1",
"Referer=",
LAST);
lr_output_message(lr_eval_string("{loginSession}"));
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={loginSession}", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
LAST);
web_submit_data("login.pl_2",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t2.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value={loginSession}", ENDITEM,
"Name=username", "Value=test1", ENDITEM,
"Name=password", "Value=1", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
"Name=login.x", "Value=62", ENDITEM,
"Name=login.y", "Value=6", ENDITEM,
LAST);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t3.inf",
LAST);
return 0;
}