51Testing软件测试论坛

标题: 脚本问题 [打印本页]

作者: bubu123    时间: 2008-5-24 02:50
标题: 脚本问题
录制loadrunner自带的Web,在订票时想对出发地和到达地进行参数化,但出现错误,脚本如下:
web_submit_form("reservations.pl",
                "Snapshot=t5.inf",
                ITEMDATA,
                "Name=depart", "Value={depart}", ENDITEM,
                "Name=departDate", "Value=05/25/2008", ENDITEM,
                "Name=arrive", "Value={arrive}", ENDITEM,
                "Name=returnDate", "Value=05/26/2008", ENDITEM,
                "Name=numPassengers", "Value=1", ENDITEM,
                "Name=roundtrip", "Value=<OFF>", ENDITEM,
                "Name=seatPref", "Value=Aisle", ENDITEM,
                "Name=seatType", "Value=Business", ENDITEM,
                "Name=findFlights.x", "Value=68", ENDITEM,
                "Name=findFlights.y", "Value=14", ENDITEM,
                LAST);

lr_output_message(lr_eval_string("{depart}"));

lr_output_message(lr_eval_string("{arrive}"));

迭代两次,第一次迭代的结果如下:
Action.c(24): Error -27979: Requested form not found          [MsgId: MERR-27979]
Action.c(24): web_submit_form("reservations.pl") highest severity level was "ERROR", 0 body bytes, 0 header bytes          [MsgId: MMSG-26388]
Ending action Action.

第二次迭代如下:
London
Action.c(41): Paris
Action.c(43): Error -27979: Requested form not found          [MsgId: MERR-27979]
Action.c(43): web_submit_form("reservations.pl_2") highest severity level was "ERROR", 0 body bytes, 0 header bytes  [MsgId: MMSG-26388]
Ending action Action.
作者: flying-kite    时间: 2008-5-24 19:45
看看这个http://blog.csdn.net/zeeslo/archive/2006/10/11/1329999.aspx

处理方法如下:
1, 打开recording options,在internet protocol下的recording中选择recording level为HTML-based script,点击HTML Advanced,选择script type为A script containing explicit.即可。
2, 选择使用URL_based script录制。
另外,附上帮助中的这个错误代码的说明:
Message Code 27979
Requested form not found

The form was not found in the page received from the server. Possible reasons: (i) The current or a previous HTML page was changed after the script was recorded. (ii) A previous request navigated to a wrong page or failed. (iii) One or more web_submit_form arguments are missing or incorrect (especially for manually coded, parameterized, or correlated functions). (iv) The server returned an unexpected page (e.g., under excessive load).

Troubleshooting
If the current or previous HTML page was changed, look for the correct properties of the form used in the text (e.g., action), and change it in the script.
If your snapshots and extended log are disabled, enable them and run the script again.
(i) To enable Snapshots: Select Tools > General Options > Correlation, and check the Save correlation information during replay box.
(ii) To enable Extended Log: Select Run-time Settings > General: Log, and check Enable logging, Always send messages, Extended log, Data returned by server, Advanced trace.
Compare the record and replay snapshots for each step in the script from the beginning, and locate the first difference. If you identify a difference in the snapshots, locate the corresponding HTTP request in both the recording log and the extended log. Compare the requests and, if they are different, have the replay issue exactly the same request. This can be done, for example, by adding web_add_header (for adding missing headers or adjusting existing ones), web_remove_auto_header (for removing extra headers), and web_add_cookie (for missing cookies).
If some correlation is missing, (e.g., the recording and replay runs have different session IDs), use the correlation tool to locate and handle such cases.
作者: flying-kite    时间: 2008-5-24 19:49
补充一些:
1、很可能是LR在录制的时候获取到的form名称有误,可以再录制一个脚本对比一下
2、还可能由于录制的脚本自动设置了关联,而从服务器返回的报文很长,超出了LoadRunner默认的参数保存长度,导致在response中找不到对应的参数。因此,在设置关联的语句之前加上如下语句:web_set_max_html_param_len("5000"); 。web_set_max_html_param_len函数用于设置需要保存的HTML字符串的长度,默认情况下,LoadRunner在做关联时,可以捕获的一个参数的最大长度是256个字符(详见LoadRunner帮助)。
作者: 注册公司吧    时间: 2008-5-24 22:16
标题: 太好了

  上海租车网提供 上海汽车租赁
作者: hongyun0703    时间: 2008-5-26 10:57
标题: 回复 4# 的帖子
建议你先不要急着参数化,直接回放一次试试,来判断是不是参数化的问题




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2