码迷,mamicode.com
首页 > 其他好文 > 详细

loadrunner自动订票脚本通用;loadrunner脚本参数化,设置检查点

时间:2018-07-15 19:44:42      阅读:213      评论:0      收藏:0      [点我收藏+]

标签:log   pre   cti   body   tar   frame   sea   ror   rri   

  1 Action()
  2 {
  3 
  4     web_reg_find("Text=Web Tours", 
  5         LAST);
  6 
  7 
  8     
  9     web_reg_save_param("session",
 10         "LB=<input type=hidden name=userSession value=",
 11         "RB=>",
 12         LAST);
 13 
 14 
 15 
 16     web_url("web_url",
 17         "URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
 18         "TargetFrame=",
 19         "Resource=0",
 20         "Referer=",
 21         LAST);
 22 
 23 
 24 
 25     
 26     web_url("web_url",
 27         "URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
 28         "TargetFrame=",
 29         "Resource=0",
 30         "Referer=",
 31         LAST);
 32 
 33 
 34 
 35 
 36     lr_start_transaction("denglu");
 37 
 38     
 39 
 40     lr_think_time(20);
 41 
 42 
 43     
 44 
 45 
 46     lr_error_message(lr_eval_string("{session}"));
 47 
 48     
 49 
 50     web_submit_data("login.pl", 
 51         "Action=http://127.0.0.1:1080/WebTours/login.pl", 
 52         "Method=POST", 
 53         "TargetFrame=", 
 54         "RecContentType=text/html", 
 55         "Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home", 
 56         "Snapshot=t3.inf", 
 57         "Mode=HTML", 
 58         ITEMDATA, 
 59         "Name=userSession", "Value={session}", ENDITEM, 
 60         "Name=username", "Value=jojo", ENDITEM, 
 61         "Name=password", "Value=bean", ENDITEM, 
 62         "Name=JSFormSubmit", "Value=off", ENDITEM, 
 63         "Name=login.x", "Value=29", ENDITEM, 
 64         "Name=login.y", "Value=5", ENDITEM, 
 65         LAST);
 66 
 67     lr_end_transaction("denglu",LR_AUTO);
 68 
 69     
 70 
 71     web_reg_find("Text=Web Tours", 
 72         LAST);
 73 
 74     lr_think_time(21);
 75 
 76     web_url("Search Flights Button", 
 77         "URL=http://127.0.0.1:1080/WebTours/welcome.pl?page=search", 
 78         "TargetFrame=body", 
 79         "Resource=0", 
 80         "RecContentType=text/html", 
 81         "Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home", 
 82         "Snapshot=t4.inf", 
 83         "Mode=HTML", 
 84         LAST);
 85 
 86     web_reg_find("Text=Flight Selections", 
 87         LAST);
 88 
 89     lr_think_time(19);
 90 
 91     web_submit_data("reservations.pl", 
 92         "Action=http://127.0.0.1:1080/WebTours/reservations.pl", 
 93         "Method=POST", 
 94         "TargetFrame=", 
 95         "RecContentType=text/html", 
 96         "Referer=http://127.0.0.1:1080/WebTours/reservations.pl?page=welcome", 
 97         "Snapshot=t5.inf", 
 98         "Mode=HTML", 
 99         ITEMDATA, 
100         "Name=advanceDiscount", "Value=0", ENDITEM, 
101         "Name=depart", "Value=London", ENDITEM, 
102         "Name=departDate", "Value=07/15/2018", ENDITEM, 
103         "Name=arrive", "Value=Los Angeles", ENDITEM, 
104         "Name=returnDate", "Value=07/16/2018", ENDITEM, 
105         "Name=numPassengers", "Value=1", ENDITEM, 
106         "Name=seatPref", "Value=None", ENDITEM, 
107         "Name=seatType", "Value=Coach", ENDITEM, 
108         "Name=.cgifields", "Value=roundtrip", ENDITEM, 
109         "Name=.cgifields", "Value=seatType", ENDITEM, 
110         "Name=.cgifields", "Value=seatPref", ENDITEM, 
111         "Name=findFlights.x", "Value=76", ENDITEM, 
112         "Name=findFlights.y", "Value=9", ENDITEM, 
113         LAST);
114 
115     web_reg_find("Text=Flight Reservation", 
116         LAST);
117 
118     lr_think_time(5);
119 
120     web_submit_data("reservations.pl_2", 
121         "Action=http://127.0.0.1:1080/WebTours/reservations.pl", 
122         "Method=POST", 
123         "TargetFrame=", 
124         "RecContentType=text/html", 
125         "Referer=http://127.0.0.1:1080/WebTours/reservations.pl", 
126         "Snapshot=t6.inf", 
127         "Mode=HTML", 
128         ITEMDATA, 
129         "Name=outboundFlight", "Value=230;773;07/15/2018", ENDITEM, 
130         "Name=numPassengers", "Value=1", ENDITEM, 
131         "Name=advanceDiscount", "Value=0", ENDITEM, 
132         "Name=seatType", "Value=Coach", ENDITEM, 
133         "Name=seatPref", "Value=None", ENDITEM, 
134         "Name=reserveFlights.x", "Value=70", ENDITEM, 
135         "Name=reserveFlights.y", "Value=17", ENDITEM, 
136         LAST);
137 
138     lr_start_transaction("buy");
139 
140     web_reg_find("Text=Reservation Made!", 
141         LAST);
142 
143     web_reg_find("Text=leaves London  for Los Angeles", 
144         LAST);
145 
146     lr_think_time(12);
147 
148     web_submit_data("reservations.pl_3", 
149         "Action=http://127.0.0.1:1080/WebTours/reservations.pl", 
150         "Method=POST", 
151         "TargetFrame=", 
152         "RecContentType=text/html", 
153         "Referer=http://127.0.0.1:1080/WebTours/reservations.pl", 
154         "Snapshot=t7.inf", 
155         "Mode=HTML", 
156         ITEMDATA, 
157         "Name=firstName", "Value=Joseph", ENDITEM, 
158         "Name=lastName", "Value=Marshall", ENDITEM, 
159         "Name=address1", "Value=234 Willow Drive", ENDITEM, 
160         "Name=address2", "Value=San Jose/CA/94085", ENDITEM, 
161         "Name=pass1", "Value=Joseph Marshall", ENDITEM, 
162         "Name=creditCard", "Value=", ENDITEM, 
163         "Name=expDate", "Value=", ENDITEM, 
164         "Name=oldCCOption", "Value=", ENDITEM, 
165         "Name=numPassengers", "Value=1", ENDITEM, 
166         "Name=seatType", "Value=Coach", ENDITEM, 
167         "Name=seatPref", "Value=None", ENDITEM, 
168         "Name=outboundFlight", "Value=230;773;07/15/2018", ENDITEM, 
169         "Name=advanceDiscount", "Value=0", ENDITEM, 
170         "Name=returnFlight", "Value=", ENDITEM, 
171         "Name=JSFormSubmit", "Value=off", ENDITEM, 
172         "Name=.cgifields", "Value=saveCC", ENDITEM, 
173         "Name=buyFlights.x", "Value=43", ENDITEM, 
174         "Name=buyFlights.y", "Value=15", ENDITEM, 
175         LAST);
176 
177     lr_end_transaction("buy",LR_AUTO);
178 
179     return 0;
180 }

 

loadrunner自动订票脚本通用;loadrunner脚本参数化,设置检查点

标签:log   pre   cti   body   tar   frame   sea   ror   rri   

原文地址:https://www.cnblogs.com/lelexiong/p/9314219.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!