51Testing软件测试论坛
标题:
录制回放时,那位大侠帮我看看啊,在线等解答....
[打印本页]
作者:
chenwenzhe
时间:
2010-10-12 20:34
标题:
录制回放时,那位大侠帮我看看啊,在线等解答....
vuser_init()
{
web_url("mercuryWebTours",
"URL=http://127.0.0.1:1080/mercuryWebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t16.inf",
"Mode=HTML",
LAST);
web_url("mercuryWebTours_2",
"URL=http://127.0.0.1:1080/mercuryWebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t17.inf",
"Mode=HTML",
LAST);
lr_think_time(9);
web_submit_form("login.pl",
"Snapshot=t18.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=41", ENDITEM,
"Name=login.y", "Value=13", ENDITEM,
LAST);
web_submit_data("login.pl_2",
"Action=http://127.0.0.1:1080/mercuryWebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?in=home",
"Snapshot=t19.inf",
"Mode=HTML",
ITEMDATA,
"Name=userSession", "Value=104243.497772377fDzcActpQVzzzzzHDcVHcpVtQf", ENDITEM,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=login.x", "Value=41", ENDITEM,
"Name=login.y", "Value=13", ENDITEM,
LAST);
return 0;
}
作者:
chenwenzhe
时间:
2010-10-12 20:34
Action()
{
lr_think_time(4);
web_image("Search Flights Button",
"Alt=Search Flights Button",
"Snapshot=t20.inf",
LAST);
web_image("Search Flights Button_2",
"Alt=Search Flights Button",
"Snapshot=t21.inf",
LAST);
web_url("reservations.pl",
"URL=http://127.0.0.1:1080/mercuryWebTours/reservations.pl?page=welcome",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=search",
"Snapshot=t22.inf",
"Mode=HTML",
LAST);
lr_think_time(22);
web_submit_form("reservations.pl_2",
"Snapshot=t23.inf",
ITEMDATA,
"Name=depart", "Value=Frankfurt", ENDITEM,
"Name=departDate", "Value=10/14/2010", ENDITEM,
"Name=arrive", "Value=Sydney", ENDITEM,
"Name=returnDate", "Value=10/17/2010", ENDITEM,
"Name=numPassengers", "Value=2", ENDITEM,
"Name=roundtrip", "Value=on", ENDITEM,
"Name=seatPref", "Value=Aisle", ENDITEM,
"Name=seatType", "Value=First", ENDITEM,
"Name=findFlights.x", "Value=65", ENDITEM,
"Name=findFlights.y", "Value=16", ENDITEM,
LAST);
web_submit_data("reservations.pl_3",
"Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl?page=welcome",
"Snapshot=t24.inf",
"Mode=HTML",
ITEMDATA,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=depart", "Value=Frankfurt", ENDITEM,
"Name=departDate", "Value=10/14/2010", ENDITEM,
"Name=arrive", "Value=Sydney", ENDITEM,
"Name=returnDate", "Value=10/17/2010", ENDITEM,
"Name=numPassengers", "Value=2", ENDITEM,
"Name=roundtrip", "Value=on", ENDITEM,
"Name=seatPref", "Value=Aisle", ENDITEM,
"Name=seatType", "Value=First", ENDITEM,
"Name=.cgifields", "Value=roundtrip", ENDITEM,
"Name=.cgifields", "Value=seatType", ENDITEM,
"Name=.cgifields", "Value=seatPref", ENDITEM,
"Name=findFlights.x", "Value=65", ENDITEM,
"Name=findFlights.y", "Value=16", ENDITEM,
LAST);
web_submit_form("reservations.pl_4",
"Snapshot=t25.inf",
ITEMDATA,
"Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
"Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
"Name=reserveFlights.x", "Value=39", ENDITEM,
"Name=reserveFlights.y", "Value=10", ENDITEM,
LAST);
web_submit_data("reservations.pl_5",
"Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Snapshot=t26.inf",
"Mode=HTML",
ITEMDATA,
"Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
"Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
"Name=numPassengers", "Value=2", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=seatType", "Value=First", ENDITEM,
"Name=seatPref", "Value=Aisle", ENDITEM,
"Name=reserveFlights.x", "Value=39", ENDITEM,
"Name=reserveFlights.y", "Value=10", ENDITEM,
LAST);
lr_think_time(22);
web_submit_form("reservations.pl_6",
"Snapshot=t27.inf",
ITEMDATA,
"Name=firstName", "Value=s", ENDITEM,
"Name=lastName", "Value=d", ENDITEM,
"Name=address1", "Value=f", ENDITEM,
"Name=address2", "Value=g", ENDITEM,
"Name=pass1", "Value=h", ENDITEM,
"Name=pass2", "Value=ja", ENDITEM,
"Name=creditCard", "Value=12", ENDITEM,
"Name=expDate", "Value=10/18", ENDITEM,
"Name=saveCC", "Value=<OFF>", ENDITEM,
"Name=buyFlights.x", "Value=61", ENDITEM,
"Name=buyFlights.y", "Value=13", ENDITEM,
LAST);
web_add_cookie("MTUserInfo=hash&47&firstName&Joseph&expDate&%0A&creditCard&&address1&234%20Willow%20Drive&lastName&Marshall%0A&address2&San%20Jose%2FCA%2F94085&username&jojo; DOMAIN=127.0.0.1");
web_submit_data("reservations.pl_7",
"Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Snapshot=t28.inf",
"Mode=HTML",
ITEMDATA,
"Name=firstName", "Value=s", ENDITEM,
"Name=lastName", "Value=d", ENDITEM,
"Name=address1", "Value=f", ENDITEM,
"Name=address2", "Value=g", ENDITEM,
"Name=pass1", "Value=h", ENDITEM,
"Name=pass2", "Value=ja", ENDITEM,
"Name=creditCard", "Value=12", ENDITEM,
"Name=expDate", "Value=10/18", ENDITEM,
"Name=oldCCOption", "Value=", ENDITEM,
"Name=numPassengers", "Value=2", ENDITEM,
"Name=seatType", "Value=First", ENDITEM,
"Name=seatPref", "Value=Aisle", ENDITEM,
"Name=outboundFlight", "Value=181;2037;10/14/2010", ENDITEM,
"Name=advanceDiscount", "Value=0", ENDITEM,
"Name=returnFlight", "Value=811;2037;10/17/2010", ENDITEM,
"Name=JSFormSubmit", "Value=off", ENDITEM,
"Name=.cgifields", "Value=saveCC", ENDITEM,
"Name=buyFlights.x", "Value=61", ENDITEM,
"Name=buyFlights.y", "Value=13", ENDITEM,
LAST);
web_submit_form("reservations.pl_8",
"Snapshot=t29.inf",
ITEMDATA,
"Name=Book Another.x", "Value=33", ENDITEM,
"Name=Book Another.y", "Value=6", ENDITEM,
LAST);
web_submit_data("reservations.pl_9",
"Action=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/reservations.pl",
"Snapshot=t30.inf",
"Mode=HTML",
ITEMDATA,
"Name=Book Another.x", "Value=33", ENDITEM,
"Name=Book Another.y", "Value=6", ENDITEM,
LAST);
web_url("welcome.pl",
"URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=flights",
"Snapshot=t31.inf",
"Mode=HTML",
LAST);
web_url("welcome.pl_2",
"URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=flights",
"Snapshot=t32.inf",
"Mode=HTML",
LAST);
web_url("itinerary.pl",
"URL=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=itinerary",
"Snapshot=t33.inf",
"Mode=HTML",
LAST);
web_submit_form("itinerary.pl_2",
"Snapshot=t34.inf",
ITEMDATA,
"Name=1", "Value=<OFF>", ENDITEM,
"Name=2", "Value=<OFF>", ENDITEM,
"Name=removeAllFlights.x", "Value=57", ENDITEM,
"Name=removeAllFlights.y", "Value=7", ENDITEM,
LAST);
web_submit_data("itinerary.pl_3",
"Action=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/itinerary.pl",
"Snapshot=t35.inf",
"Mode=HTML",
ITEMDATA,
"Name=flightID", "Value=0-1393703-ab", ENDITEM,
"Name=flightID", "Value=4511556-2162934-sd", ENDITEM,
"Name=.cgifields", "Value=1", ENDITEM,
"Name=.cgifields", "Value=2", ENDITEM,
"Name=removeAllFlights.x", "Value=57", ENDITEM,
"Name=removeAllFlights.y", "Value=7", ENDITEM,
LAST);
web_url("welcome.pl_3",
"URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=menus",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=itinerary",
"Snapshot=t36.inf",
"Mode=HTML",
LAST);
web_url("welcome.pl_4",
"URL=http://127.0.0.1:1080/mercuryWebTours/welcome.pl?page=menus",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/mercuryWebTours/nav.pl?page=menu&in=itinerary",
"Snapshot=t37.inf",
"Mode=HTML",
LAST);
return 0;
}
作者:
chenwenzhe
时间:
2010-10-12 20:34
vuser_end()
{
lr_think_time(5);
web_image("SignOff Button",
"Alt=SignOff Button",
"Snapshot=t38.inf",
LAST);
web_add_cookie("MSO=SID&1286885980; DOMAIN=127.0.0.1");
web_add_cookie("MTUserInfo=firstName&Joseph&hash&47&lastName&Marshall%0A&address1&234%20Willow%20Drive&username&jojo&address2&San%20Jose%2FCA%2F94085; DOMAIN=127.0.0.1");
web_image("SignOff Button_2",
"Alt=SignOff Button",
"Snapshot=t39.inf",
LAST);
return 0;
}
作者:
chenwenzhe
时间:
2010-10-12 20:35
原代码就是这些,
是使用的LR中自带的sample,
使用的HTML录制方式
作者:
chenwenzhe
时间:
2010-10-12 21:41
已解决
作者:
cjp110212
时间:
2010-10-13 11:15
本帖最后由 cjp110212 于 2010-10-13 11:16 编辑
回复
5#
chenwenzhe
能不能说下是怎么解决的??再说一下详细的录制模式,我试了一下,录制不到你那个web_image函数。
而且我看着,你这个脚本中,好像有些动作做了两遍??比如登录、注销,等等,只要一个函数就能完成了吧?
你这个脚本中怎么都是有两个函数呢?
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2