|
LR录制完自动关闭,这个问题似乎有很多人遇到过。其实我一直没有找到真正的原因。不过,没有吃过猪肉不代表没有看过猪跑,没有练过武功不代表不能将你打倒。(这半句是我原创。^_^)
话说多年以前,我曾经写过一个贴子,用一个土办法暂时“解决”了这一问题。具体办法请看下面这个链接:
http://www.blogjava.net/xingcyx/archive/2008/07/16/215190.html
今天,我很不幸地又遇到了同样的问题。有了前面的遭遇,这次我处变不惊,临危不乱,用同样的办法操作了一遍。但是,令我始料不及的是,一种更加诡异的情况出现了!
我的脚本很简单,是一个模拟发送传真的动作,脚本如下:
脚本A
Action()
{
web_url("mptest",
"URL=http://192.168.39.164:8000/mptest/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_link("发送传真",
"Text=发送传真",
"Snapshot=t2.inf",
LAST);
lr_think_time( 19 );
web_custom_request("SendFax",
"URL=http://192.168.39.164:8000/mptest/SendFax",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.39.164:8000/mptest/sendFax.jsp",
"Snapshot=t3.inf",
"Mode=HTML",
"EncType=multipart/form-data; boundary=---------------------------7d97d2d7209f6",
"BodyBinary=-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"address\"\r\n"
"\r\n"
"05928556088\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"senderName\"\r\n"
"\r\n"
"05928064212\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"title\"\r\n"
"\r\n"
"sfsd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"content\"\r\n"
"\r\n"
"sfd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"email\"\r\n"
"\r\n"
"dfd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"pageheader\"\r\n"
"\r\n"
"sf\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"attachment\"; filename=\"C:"
"\\x5C"
"Documents and Settings"
"\\x5C"
"Administrator"
"\\x5C"
"妗岄潰"
"\\x5C"
"1.txt\"\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"一、G网测试:\r\n"
"SE W810c、Nokia 6120c、Motorola W510、SE W800c\r\n"
"二、C网测试:\r\n"
"三、回归测试:\r\n"
"SE W580i、NOkia n93、Nokia6670(9.9号安排回归测试)\r\n"
"Motorola Z3、SE W810c(9.8号安排回归测试)\r\n"
"NOKIA5700、Nokia N73(9.5号安排回归测试)\r\n"
"\r\n"
"\r\n"
"*57*号码#\r\n"
"*41*号码#\r\n"
"#57#\r\n"
"\r\n"
"0951-8121648\r\n"
"\r\n"
"-----------------------------7d97d2d7209f6--\r\n"
"",
LAST);
return 0;
}
复制粘贴后回放,LR用红字提示:
Action.c(23): Error -27995: Requested link ("Text=发送传真") not found [MsgId: MERR-27995]
Action.c(23): web_link("发送传真") highest severity level was "ERROR", 0 body bytes, 0 header bytes [MsgId: MMSG-26388]
找不到链接?见鬼了!明明有的啊。
重新开一个脚本,另外录制一个再试试:
脚本B
Action()
{
web_url("mptest",
"URL=http://192.168.39.164:8000/mptest/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_link("发送传真",
"Text=发送传真",
"Snapshot=t2.inf",
LAST);
return 0;
}
回放,OK!
哈哈,小样的,难不倒我。
把脚本B的
web_link("发送传真",
"Text=发送传真",
"Snapshot=t2.inf",
LAST);
这段脚本copy回原先的脚本A,这总没问题了吧?
点击回放,LR还是提示刚才的错误。咦?这是咋回事?
此路不通,我就反其道而行之。反过来把
web_custom_request("SendFax",
"URL=http://192.168.39.164:8000/mptest/SendFax",
"Method=POST",
"Resource=0",
"RecContentType=text/html",
"Referer=http://192.168.39.164:8000/mptest/sendFax.jsp",
"Snapshot=t3.inf",
"Mode=HTML",
"EncType=multipart/form-data; boundary=---------------------------7d97d2d7209f6",
"BodyBinary=-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"address\"\r\n"
"\r\n"
"05928556088\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"senderName\"\r\n"
"\r\n"
"05928064212\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"title\"\r\n"
"\r\n"
"sfsd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"content\"\r\n"
"\r\n"
"sfd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"email\"\r\n"
"\r\n"
"dfd\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"pageheader\"\r\n"
"\r\n"
"sf\r\n"
"-----------------------------7d97d2d7209f6\r\n"
"Content-Disposition: form-data; name=\"attachment\"; filename=\"C:"
"\\x5C"
"Documents and Settings"
"\\x5C"
"Administrator"
"\\x5C"
"妗岄潰"
"\\x5C"
"1.txt\"\r\n"
"Content-Type: text/plain\r\n"
"\r\n"
"一、G网测试:\r\n"
"SE W810c、Nokia 6120c、Motorola W510、SE W800c\r\n"
"二、C网测试:\r\n"
"三、回归测试:\r\n"
"SE W580i、NOkia n93、Nokia6670(9.9号安排回归测试)\r\n"
"Motorola Z3、SE W810c(9.8号安排回归测试)\r\n"
"NOKIA5700、Nokia N73(9.5号安排回归测试)\r\n"
"\r\n"
"\r\n"
"*57*号码#\r\n"
"*41*号码#\r\n"
"#57#\r\n"
"\r\n"
"0951-8121648\r\n"
"\r\n"
"-----------------------------7d97d2d7209f6--\r\n"
"",
LAST);
这段copy到脚本B中,回放,成功!
不知道大家看明白了没有,整个过程的确是很诡异,我也没搞懂这是为什么,但至少最终还是把问题解决了。有的时候,测试人员千万不要认死理,一条胡同走到黑,遇到问题的时候试试换个角度去解决。
山重水复疑无路,柳暗花明又一村! |
|