51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2353|回复: 4
打印 上一主题 下一主题

[原创] 脚本问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2008-5-24 02:50:13 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
录制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.
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2008-5-24 19:45:05 | 只看该作者
看看这个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.
回复 支持 反对

使用道具 举报

该用户从未签到

3#
发表于 2008-5-24 19:49:47 | 只看该作者
补充一些:
1、很可能是LR在录制的时候获取到的form名称有误,可以再录制一个脚本对比一下
2、还可能由于录制的脚本自动设置了关联,而从服务器返回的报文很长,超出了LoadRunner默认的参数保存长度,导致在response中找不到对应的参数。因此,在设置关联的语句之前加上如下语句:web_set_max_html_param_len("5000"); 。web_set_max_html_param_len函数用于设置需要保存的HTML字符串的长度,默认情况下,LoadRunner在做关联时,可以捕获的一个参数的最大长度是256个字符(详见LoadRunner帮助)。
回复 支持 反对

使用道具 举报

该用户从未签到

4#
发表于 2008-5-24 22:16:07 | 只看该作者

太好了

回复 支持 反对

使用道具 举报

该用户从未签到

5#
发表于 2008-5-26 10:57:38 | 只看该作者

回复 4# 的帖子

建议你先不要急着参数化,直接回放一次试试,来判断是不是参数化的问题
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-11-15 11:41 , Processed in 0.091928 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表