Highlighted
Absent Member.
Absent Member.
231 views

Wierd Vuser script

Hi

I am very new to LoadRunner . I have just started going trough the tutorial .

I have recorded the Webtours application that comes with loadRunner after the log out the generated script is ad follow :

Code:



Action()
{

web_url("WebTours",
"URL=http://localhost:1080/WebTours",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

web_url("WebTours_2",
"URL=http://localhost:9933/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);

lr_think_time(7);

web_submit_data("login.pl",
"Action=http://localhost:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?in=home",
"Snapshot=t3.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=105132.127339004ftAHHDDpiDcttzptAci", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=8", ENDITEM,
LAST);

web_submit_data("login.pl_2",
"Action=http://localhost:9933/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?in=home",
"Snapshot=t4.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=105132.127339004ftAHHDDpiDcttzptAci", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=on", ENDITEM,
"Name=login.x", "Value=49", ENDITEM,
"Name=login.y", "Value=8", ENDITEM,
LAST);

web_url("welcome.pl",
"URL=http://localhost:1080/WebTours/welcome.pl?page=search",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t5.inf",
"Mode=HTML",
LAST);

web_url("welcome.pl_2",
"URL=http://localhost:9933/WebTours/welcome.pl?page=search",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t6.inf",
"Mode=HTML",
LAST);

lr_think_time(11);

web_url("FormDateUpdate.class",
"URL=http://localhost:1080/WebTours/FormDateUpdate.class",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);

web_url("CalSelect.class",
"URL=http://localhost:1080/WebTours/CalSelect.class",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);

web_url("Calendar.class",
"URL=http://localhost:1080/WebTours/Calendar.class",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);

lr_think_time(4);

web_submit_data("reservations.pl",
"Action=http://localhost:1080/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl?page=welcome",
"Snapshot=t7.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value=Denver", ENDITEM,
"Name=departDate", "Value=02/17/2011", ENDITEM,
"Name=arrive", "Value=Los Angeles", ENDITEM,
"Name=returnDate", "Value=02/18/2011", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=.cgifields", "Value=roundtrip", ENDITEM,
"Name=.cgifields", "Value=seatType", ENDITEM,
"Name=.cgifields", "Value=seatPref", ENDITEM,
"Name=findFlights.x", "Value=62", ENDITEM,
"Name=findFlights.y", "Value=7", ENDITEM,
LAST);

web_submit_data("reservations.pl_2",
"Action=http://localhost:9933/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl?page=welcome",
"Snapshot=t8.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value=Denver", ENDITEM,
"Name=departDate", "Value=02/17/2011", ENDITEM,
"Name=arrive", "Value=Los Angeles", ENDITEM,
"Name=returnDate", "Value=02/18/2011", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=.cgifields", "Value=roundtrip", ENDITEM,
"Name=.cgifields", "Value=seatType", ENDITEM,
"Name=.cgifields", "Value=seatPref", ENDITEM,
"Name=findFlights.x", "Value=62", ENDITEM,
"Name=findFlights.y", "Value=7", ENDITEM,
LAST);

web_submit_data("reservations.pl_3",
"Action=http://localhost:1080/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl",
"Snapshot=t9.inf",
"Mode=HTML",
ITEMDATA,
"Name=outboundFlight", "Value=030;251;02/17/2011", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=reserveFlights.x", "Value=32", ENDITEM,
"Name=reserveFlights.y", "Value=2", ENDITEM,
LAST);

web_submit_data("reservations.pl_4",
"Action=http://localhost:9933/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl",
"Snapshot=t10.inf",
"Mode=HTML",
ITEMDATA,
"Name=outboundFlight", "Value=030;251;02/17/2011", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=reserveFlights.x", "Value=32", ENDITEM,
"Name=reserveFlights.y", "Value=2", ENDITEM,
LAST);

web_submit_data("reservations.pl_5",
"Action=http://localhost:1080/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl",
"Snapshot=t11.inf",
"Mode=HTML",
ITEMDATA,
"Name=firstName", "Value=Joseph", ENDITEM,
"Name=lastName", "Value=Marshall", ENDITEM,
"Name=address1", "Value=234 Willow Drive", ENDITEM,
"Name=address2", "Value=San Jose/CA/94085", ENDITEM,
"Name=pass1", "Value=Joseph Marshall", ENDITEM,
"Name=creditCard", "Value=12345678", ENDITEM,
"Name=expDate", "Value=01/10", ENDITEM,
"Name=saveCC", "Value=on", ENDITEM,
"Name=oldCCOption", "Value=on", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=outboundFlight", "Value=030;251;02/17/2011", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=returnFlight", "Value=", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=.cgifields", "Value=saveCC", ENDITEM,
"Name=buyFlights.x", "Value=45", ENDITEM,
"Name=buyFlights.y", "Value=4", ENDITEM,
LAST);

web_add_cookie("MTUserInfo=firstName&Joseph&address2&San%20Jose%2FCA%2F94085&username&jojo&hash&47&lastName&Marshall%0A&address1&234%20Willow%20Drive&creditCard&12345678&expDate&01%2F10%0A; DOMAIN=localhost");

web_submit_data("reservations.pl_6",
"Action=http://localhost:9933/WebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/reservations.pl",
"Snapshot=t12.inf",
"Mode=HTML",
ITEMDATA,
"Name=firstName", "Value=Joseph", ENDITEM,
"Name=lastName", "Value=Marshall", ENDITEM,
"Name=address1", "Value=234 Willow Drive", ENDITEM,
"Name=address2", "Value=San Jose/CA/94085", ENDITEM,
"Name=pass1", "Value=Joseph Marshall", ENDITEM,
"Name=creditCard", "Value=12345678", ENDITEM,
"Name=expDate", "Value=01/10", ENDITEM,
"Name=saveCC", "Value=on", ENDITEM,
"Name=oldCCOption", "Value=on", ENDITEM,
"Name=numPassengers", "Value=1", ENDITEM,
"Name=seatType", "Value=Coach", ENDITEM,
"Name=seatPref", "Value=None", ENDITEM,
"Name=outboundFlight", "Value=030;251;02/17/2011", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=returnFlight", "Value=", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=.cgifields", "Value=saveCC", ENDITEM,
"Name=buyFlights.x", "Value=45", ENDITEM,
"Name=buyFlights.y", "Value=4", ENDITEM,
LAST);

lr_think_time(5);

web_url("welcome.pl_3",
"URL=http://localhost:1080/WebTours/welcome.pl?page=itinerary",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=flights",
"Snapshot=t13.inf",
"Mode=HTML",
LAST);

web_url("welcome.pl_4",
"URL=http://localhost:9933/WebTours/welcome.pl?page=itinerary",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=flights",
"Snapshot=t14.inf",
"Mode=HTML",
LAST);

lr_think_time(11);

web_url("welcome.pl_5",
"URL=http://localhost:1080/WebTours/welcome.pl?signOff=1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=itinerary",
"Snapshot=t15.inf",
"Mode=HTML",
LAST);

web_add_cookie("MSO=SID&1297856112&MSO_JSFormSubmit1&on&MSO_ServerErrorsProb&50&MSO_ServerLoadProb&50; DOMAIN=localhost");

web_add_cookie("MTUserInfo=firstName&Joseph&username&jojo&address2&San%20Jose%2FCA%2F94085&hash&47&expDate&01%2F10&creditCard&12345678&address1&234%20Willow%20Drive&lastName&Marshall%0A; DOMAIN=localhost");

web_url("welcome.pl_6",
"URL=http://localhost:9933/WebTours/welcome.pl?signOff=1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://localhost:1080/WebTours/nav.pl?page=menu&in=itinerary",
"Snapshot=t16.inf",
"Mode=HTML",
LAST);

return 0;
}






When I try to replay and the following error shows :
Message Code 27791 Server 'server name' has shut down the connection prematurely . After digging a bit in the code i noticed that for every action i made loadRunner generate another script pointing to different port.
For exp Code:


web_url("WebTours",
"URL=http://localhost:1080/WebTours",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);

web_url("WebTours_2",
"URL=http://localhost:9933/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTML",
LAST);




Any hints why loadrunner behaves this way ? Thanks
0 Likes
1 Reply
Highlighted
Absent Member.
Absent Member.

Re: Wierd Vuser script

You may not be able to replay this directly after recording until you've correlated the 'userSession' value and any other dynamic values. Have you done this in the script you're trying to play back? The session IDs may expire after each run.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.