51Testing软件测试论坛

标题: 我在用LR跑场景的时候出现了几个问题,求高手指点 [打印本页]

作者: zhang2min    时间: 2012-1-11 17:12
标题: 我在用LR跑场景的时候出现了几个问题,求高手指点
Action.c(18): Error -26374: The above "not found" error(s) may be explained by header and body byte counts being 0 and 0, respectively.

Action.c(18): Error -26377: No match found for the requested parameter "Siebel_Analytic_ViewState4". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 3000 bytes, use web_set_max_html_param_len to increase the parameter size

Action.c(18): Error -27727: Step download timeout (1000 seconds) has expired when downloading resource(s). Set the "Resource Page Timeout is a Warning" Run-Time Setting to Yes/No to have this message as a warning/error, respectively

Action.c(18): Error -27728: Step download timeout (1000 seconds) has expired when downloading non-resource(s)
作者: zhang2min    时间: 2012-1-11 17:22
脚本没有问题,运行正常,我在网上找了很久都没有找到怎么解决,不知道是那里的问题我把脚本帖出来,希望帮我分析一下web_set_ma

web_reg_sa
    "LB/IC
    "RB/IC
    "Ord=1
    "Searc
    "RelFr
    LAST);

web_url("i
    "URL=h
    "Resou
    "RecCo
    "Refer
    "Snaps
    "Mode=
    EXTRAR
    "Url=/
    "Url=/
    "Url=h
    "Url=h
    "Url=h
    "Url=h
    "Url=/
    "Url=/
    "Url=/
    "Url=h
    "Url=h
    "Url=/
    "Url=h
    "Url=h
    "Url=/
    "Url=/
    "Url=h
    "Url=h
    "Url=h
    "Url=h
    LAST);


lr_think_t

lr_rendezv

lr_start_t

web_submit
    "Actio
    "Metho
    "RecCo
    "Refer
    "Snaps
    "Mode=
    ITEMDA
    "Name=
    "Name=
    "Name=
    "Name=
    "Name=
    "Name=
    "Name=
    "Name=
    LAST);



lr_end_tra

web_url("i
    "URL=h
    "Resou
    "RecCo
    "Refer
    "Snaps
    "Mode=
    EXTRAR
    "Url=/
    "Url=/
    "Url=h
    "Url=h
    "Url=h
    "Url=h
    "Url=/
    "Url=h
    "Url=h
    "Url=h
    "Url=/
    "Url=/
    "Url=/
    "Url=/
    "Url=h
    "Url=h
    "Url=h
    "Url=h
    "Url=/
    LAST);
lr_think_t
web_link("
    "Text=
    "Ordin
    "Snaps
    EXTRAR
    "Url=/
    "Url=/
    "Url=h
    "Url=/
    "Url=/
    "Url=/
    "Url=/
    "Url=h
    "Url=/
    "Url=/
    "Url=/
    "Url=/
    "Url=h
    LAST);

lr_think_t

web_submit
    "Actio
    "Metho
    "RecCo
    "Refer
    "Snaps
    "Mode=
    ITEMDA
    "Name=
    "Name=
    "Name=
    "eetie
    "jcPDx
    LAST);



web_find("
    "What=
    LAST);

web_url("i
    "URL=h
    "Resou
    "RecCo
    "Refer
    "Snaps
    "Mode=
    LAST);

web_url("l
    "URL=h
    "Resou
    "RecCo
    "Refer
    "Snaps
    "Mode=
    LAST);
作者: zhang2min    时间: 2012-1-11 17:23
回复 2# szyszy2000


    web_set_max_html_param_len("3000");

         web_reg_save_param("Siebel_Analytic_ViewState4",
                 "LB/IC=ViewState\" value=\"",
                 "RB/IC=\"",
                 "Ord=1",
                 "Search=Body",
                 "RelFrameId=1.2",
                 LAST);

         web_url("index.aspx",
                 "URL=http://www.1hai.cn/index.aspx",
                 "Resource=0",
                 "RecContentType=text/html",
                 "Referer=",
                 "Snapshot=t1.inf",
                 "Mode=HTML",
                 EXTRARES,
                 "Url=/images/starindex.gif", ENDITEM,
                 "Url=/images/menu_right.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/bg-sp-hn.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/more_avtive.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/bg-hbh.jpg", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/bg-sp-0218.png", ENDITEM,
                 "Url=/images/bg-norder.png", ENDITEM,
                 "Url=/images/bg_tjzc_title.jpg", ENDITEM,
                 "Url=/images/bg_tyj.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/sp3.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/sp0510.png", "Referer=http://www.1hai.cn/loginiframe.aspx", ENDITEM,
                 "Url=/WebResource.axd?d=VXKB3fkqegYIJXaI5b_q_A2&t=634062435683125000", "Referer=http://www.1hai.cn/loginiframe.aspx", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/logo-n.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/bg-norder.png", ENDITEM,
                 "Url=/Images/cal.gif", ENDITEM,
                 "Url=/images/line_align.png", ENDITEM,
                 "Url=http://www.google-analytics.com/ga.js", ENDITEM,
                 "Url=http://830.oadz.com/cnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;MpyIXRNEFnDH4Wt0qi87PaR2+io=;?1&http%3A//www.1hai.cn/index.aspx&-&-&-&ozlvd=1326253257&ozept=%u4E00%u55E8%u79DF%u8F66_%u5F15%u9886%u4E2D%u56FD%u6C7D%u8F66%u79DF%u8D41%u884C%u4E1A%2C%u5021%u5BFC%u65F6%u5C1A%u751F%u6D3B%u65B9%u5F0F%2C%u5317%u4EAC%u4E0A%u6D77%u5E7F&ozsru=-&ozsat=-", ENDITEM,
                 "Url=http://www.google-analytics.com/__utm.gif?utmwv=5.2.2&utms=1&utmn=1561149022&utmhn=www.1hai.cn&utmcs=gb2312&utmsr=1366x768&utmsc=32-bit&utmul=zh-cn&utmje=1&utmfl=10.0%20r12&utmdt=%E4%B8%80%E5%97%A8%E7%A7%9F%E8%BD%A6_%E5%BC%95%E9%A2%86%E4%B8%AD%E5%9B%BD%E6%B1%BD%E8%BD%A6%E7%A7%9F%E8%B5%81%E8%A1%8C%E4%B8%9A%2C%E5%80%A1%E5%AF%BC%E6%97%B6%E5%B0%9A%E7%94%9F%E6%B4%BB%E6%96%B9%E5%BC%8F%2C%E5%8C%97%E4%BA%AC%E4%B8%8A%E6%B5%B7%E5%B9%BF%E5%B7%9E%E6%B7%B1%E5%9C%B370%E4%B8%AA%E5%9F%8E%E5%B8%82%E5%BC%82%E5%9C%B0%E8%BF%98%E8%BD%A6&utmhid=866226800&utmr=-&utmp=%2Findex.aspx&utmac=UA-5138074-1&utmcc=__utma%3D138224944.1980320583.1326252384.1326252384.1326262102.2%3B%2B__utmz%3D138224944.1326252384.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=qB~", ENDITEM,
                 "Url=http://830.oadz.com/jcnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;x2F03qcghZhZiYenGZICpq+geEs=;?1&http%3A//www.1hai.cn/index.aspx&-&-&INPUT*btnLogin*170*38&-&ozsru=-", ENDITEM,
                 LAST);

         
         lr_think_time( 2 );

         lr_rendezvous("jihe");

         lr_start_transaction("kais");
         
         web_submit_data("loginiframe.aspx",
                 "Action=http://www.1hai.cn/loginiframe.aspx",
                 "Method=POST",
                 "RecContentType=text/html",
                 "Referer=http://www.1hai.cn/loginiframe.aspx",
                 "Snapshot=t2.inf",
                 "Mode=HTML",
                 ITEMDATA,
                 "Name=__VIEWSTATE", "Value={Siebel_Analytic_ViewState4}", ENDITEM,
                 "Name=txtUser", "Value=15901622984", ENDITEM,
                 "Name=txtPassword", "Value=123456", ENDITEM,
                 "Name=btnLogin", "Value= ?", ENDITEM,
                 "Name=hdnAction", "Value=", ENDITEM,
                 "Name=hdnUrl", "Value=", ENDITEM,
                 "Name=__EVENTTARGET", "Value=", ENDITEM,
                 "Name=__EVENTARGUMENT", "Value=", ENDITEM,
                 LAST);



         lr_end_transaction("kais", LR_AUTO);

         web_url("index.aspx_2",
                 "URL=http://www.1hai.cn/index.aspx",
                 "Resource=0",
                 "RecContentType=text/html",
                 "Referer=",
                 "Snapshot=t3.inf",
                 "Mode=HTML",
                 EXTRARES,
                 "Url=/images/menu_right.png", ENDITEM,
                 "Url=/images/starindex.gif", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/more_avtive.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/bg-sp-hn.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/bg-hbh.jpg", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/sp3.png", ENDITEM,
                 "Url=/images/bg_tjzc_title.jpg", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/logo-n.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/comm/bg-norder.png", ENDITEM,
                 "Url=http://s1.1haimg.cn/image/index/bg-sp-0218.png", ENDITEM,
                 "Url=/Images/cal.gif", ENDITEM,
                 "Url=/images/bg_tyj.png", ENDITEM,
                 "Url=/images/bg-norder.png", ENDITEM,
                 "Url=/images/line_align.png", ENDITEM,
                 "Url=http://www.google-analytics.com/ga.js", ENDITEM,
                 "Url=http://830.oadz.com/cnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;MpyIXRNEFnDH4Wt0qi87PaR2+io=;?1&http%3A//www.1hai.cn/index.aspx&-&-&-&ozlvd=1326262101&ozept=%u4E00%u55E8%u79DF%u8F66_%u5F15%u9886%u4E2D%u56FD%u6C7D%u8F66%u79DF%u8D41%u884C%u4E1A%2C%u5021%u5BFC%u65F6%u5C1A%u751F%u6D3B%u65B9%u5F0F%2C%u5317%u4EAC%u4E0A%u6D77%u5E7F&ozsru=-&ozsat=-", ENDITEM,
                 "Url=http://www.google-analytics.com/__utm.gif?utmwv=5.2.2&utms=2&utmn=1806130525&utmhn=www.1hai.cn&utmcs=gb2312&utmsr=1366x768&utmsc=32-bit&utmul=zh-cn&utmje=1&utmfl=10.0%20r12&utmdt=%E4%B8%80%E5%97%A8%E7%A7%9F%E8%BD%A6_%E5%BC%95%E9%A2%86%E4%B8%AD%E5%9B%BD%E6%B1%BD%E8%BD%A6%E7%A7%9F%E8%B5%81%E8%A1%8C%E4%B8%9A%2C%E5%80%A1%E5%AF%BC%E6%97%B6%E5%B0%9A%E7%94%9F%E6%B4%BB%E6%96%B9%E5%BC%8F%2C%E5%8C%97%E4%BA%AC%E4%B8%8A%E6%B5%B7%E5%B9%BF%E5%B7%9E%E6%B7%B1%E5%9C%B370%E4%B8%AA%E5%9F%8E%E5%B8%82%E5%BC%82%E5%9C%B0%E8%BF%98%E8%BD%A6&utmhid=410164658&utmr=-&utmp=%2Findex.aspx&utmac=UA-5138074-1&utmcc=__utma%3D138224944.1980320583.1326252384.1326252384.1326262102.2%3B%2B__utmz%3D138224944.1326252384.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=qB~", ENDITEM,
                 "Url=http://830.oadz.com/jcnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;x2F03qcghZhZiYenGZICpq+geEs=;?1&http%3A//www.1hai.cn/index.aspx&-&-&A*-*49*89&http%3A//www.1hai.cn/loginiframe.aspx%23&ozsru=-", ENDITEM,
                 "Url=/images/save.png", ENDITEM,
                 LAST);
         lr_think_time( 2 );
         web_link("        ",
                 "Text=        ",
                 "Ordinal=2",
                 "Snapshot=t4.inf",
                 EXTRARES,
                 "Url=/images/bg-sp-hn.png", ENDITEM,
                 "Url=/images/bg-sp-nmy1hai.png", ENDITEM,
                 "Url=http://www.google-analytics.com/__utm.gif?utmwv=5.2.2&utms=3&utmn=2139349209&utmhn=www.1hai.cn&utmcs=gb2312&utmsr=1366x768&utmsc=32-bit&utmul=zh-cn&utmje=1&utmfl=10.0%20r12&utmdt=%E6%88%91%E7%9A%84%E4%B8%80%E5%97%A8_%E4%B8%80%E5%97%A8%E7%A7%9F%E8%BD%A6&utmhid=2142398998&utmr=-&utmp=%2Fmyehai.aspx&utmac=UA-5138074-1&utmcc=__utma%3D138224944.1980320583.1326252384.1326252384.1326262102.2%3B%2B__utmz%3D138224944.1326252384.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=H~", ENDITEM,
                 "Url=/images/bg-spmyehai-side.png", ENDITEM,
                 "Url=/images/weijihuo-email.gif", ENDITEM,
                 "Url=/images/weijihuo-phone.gif", ENDITEM,
                 "Url=/images/boxTitle.gif", ENDITEM,
                 "Url=http://830.oadz.com/cnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;MpyIXRNEFnDH4Wt0qi87PaR2+io=;?1&http%3A//www.1hai.cn/myehai.aspx&-&-&-&ozlvd=1326262188&ozept=%u6211%u7684%u4E00%u55E8_%u4E00%u55E8%u79DF%u8F66&ozsru=-&ozsat=-", ENDITEM,
                 "Url=/PopGreyLayer/closewindow.gif", ENDITEM,
                 "Url=/PopGreyLayer/header.gif", ENDITEM,
                 "Url=/PopGreyLayer/pop_close.gif", ENDITEM,
                 "Url=/PopGreyLayer/loading.gif", ENDITEM,
                 "Url=http://830.oadz.com/jcnt;C1;830;.1hai.cn:.ehicar.com:.mop.com;x2F03qcghZhZiYenGZICpq+geEs=;?1&http%3A//www.1hai.cn/myehai.aspx&-&-&A*ctl00_lnblayout1*545*4&javascript%3A__doPostBack%28%27ctl00%24lnblayout1%27%2C%27%27%29&ozsru=-", ENDITEM,
                 LAST);
作者: zhang2min    时间: 2012-1-11 17:23
回复 3# zhang2min


   
         lr_think_time( 6 );

         web_submit_data("myehai.aspx",
                 "Action=http://www.1hai.cn/myehai.aspx",
                 "Method=POST",
                 "RecContentType=text/html",
                 "Referer=http://www.1hai.cn/myehai.aspx",
                 "Snapshot=t5.inf",
                 "Mode=HTML",
                 ITEMDATA,
                 "Name=__EVENTTARGET", "Value=ctl00$lnblayout1", ENDITEM,
                 "Name=__EVENTARGUMENT", "Value=", ENDITEM,
                 "Name=__VIEWSTATE", "Value=/wEPDwULLTE2ODE3NjM1MjUPZBYCZg9kFgICAw9kFgZmDxYCHgdWaXNpYmxlaGQCAQ9kFgICAQ8PFgIeBFRleHQFEDUzMDQyNjI4MEBxcS5jb21kZAICD2QWOgIHDw8WAh8BZWRkAgsPFgIfAQXnATxzcGFuIGlkPSdqaWh1by1lbWFpbCcgY2xhc3M9J3dlaWppaHVvLWUnIG9ubW91c2VvdmVyPSdkb2N1bWVudC5nZXRFbGVtZW50QnlJZCgiYWN0aXZlIikuc3R5bGUuZGlzcGxheT0iIicgb25tb3VzZW91dD0nZG9jdW1lbnQu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qjmjIfljZcfBAUGX2JsYW5rHwUFH25ld3NkZXRhaWwuYXNweD9pZD03NjUmJmdyb3VwPTJkZAJDDw8WAh8BBQoyMDExLTEwLTA5ZGQCRQ8PFgYfAQUk5Lit55+z5YyW5YyX5Lqs55+z5rK55Lya5ZGY5Y2h5rS75YqoHwQFBl9ibGFuax8FBR9uZXdzZGV0YWlsLmFzcHg/aWQ9NzU2JiZncm91cD0yZGQCRw8PFgIfAQUKMjAxMS0wOS0wMWRkZBVYz+t1EuP0qo2LaB/7ZZb91aMK", ENDITEM,
                 LAST);



         web_find("web_find",
                 "What=530426280@qq.com",
                 LAST);

         web_url("indexlogin.aspx",
                 "URL=http://www.1hai.cn/Modules/indexlogin.aspx",
                 "Resource=0",
                 "RecContentType=text/html",
                 "Referer=http://www.1hai.cn/index.aspx",
                 "Snapshot=t6.inf",
                 "Mode=HTML",
                 LAST);

         web_url("loginiframe.aspx_2",
                 "URL=http://www.1hai.cn/loginiframe.aspx",
                 "Resource=0",
                 "RecContentType=text/html",
                 "Referer=http://www.1hai.cn/index.aspx",
                 "Snapshot=t7.inf",
                 "Mode=HTML",
                 LAST);
作者: msnshow    时间: 2012-1-11 21:55
关联没找到,下载资源超时
作者: 夏日摸摸茶    时间: 2012-1-12 09:43
脚步回放就应该有问题吧
作者: zhang2min    时间: 2012-1-12 11:37
回复 7# 夏日摸摸茶


    脚本回放没有问题 是正常的
作者: zhang2min    时间: 2012-1-12 11:38
回复 6# msnshow


    我查了很多的资料 ,关联的函数不知道应该怎么弄,求解
作者: fly_away    时间: 2012-1-13 21:32
[quote]回复  夏日摸摸茶


    脚本回放没有问题 是正常的


也许应该试试给Action多加几轮迭代

单次回放没有问题不能说明什么。
如果多轮迭代发生错误,那就说明脚本录制有问题。

PS:老兄你真逗,这么多代码愣是没到见一行注释
作者: msnshow    时间: 2012-1-14 21:50
1.获取单个参数
看下面例子:
web_reg_save_param("param","LB/ic="Value=","RB="","ORD=1",LAST);
上面的语句把页面上发现的第一个值存放到param参数中,当然param和你通常定义的变量是有区别的,它是参数不是变量,这个概念要搞清楚,你不能象下面这样给他赋值:
char testParam[20];
sprintf(testParam,"%s",param);
而应该象下面这样:
sprintf(testParam,"%s",lr_eval_string("{param}"));
下面是一个提交随机内容的函数:
web_submit_form("tpcc.pr.prC_ITEMUpdate.do",
"Snapshot=t7.inf",
ITEMDATA,
"Name=C_ITEM/I_IM_ID", "Value={im_id}", ENDITEM,
"Name=C_ITEM/I_NAME", "Value={i_name2_value}", ENDITEM,
"Name=C_ITEM/I_PRICE", "Value=12.11", ENDITEM,
"Name=C_ITEM/I_DATA", "Value={i_name_value}", ENDITEM,
LAST);
上面大括号中的都是参数,你可以生成一些随机字符串提交,更真实的仿真用户操作.当然你也可以整个把"Value={im_id}"用参数替换,当然你的参数得符合"Value=XXXXX"的格式了:
"Name=C_ITEM/I_IM_ID", "{test_param}", ENDITEM,
也可以整个把它用变量替换:
char test_str[]="Value=afadfafa";
"Name=C_ITEM/I_IM_ID", test_param, ENDITEM,
注意他们之间的差别

2.参数数组
有时候你可能查询回来很多记录,你可能想随机修改其中的某一条,你可以从返回页面获得所有的记录号存放在一个参数数组中:
web_reg_save_param("param_array","LB/ic="Value=","RB="","ORD=ALL",LAST);
其中param_array_1代表参数一,param_array_2代表参数二...,获取数组长度可以这样:
int array_len,rand_id;
char array_name[20];
array_len=atoi(lr_eval_string("{param_array_count}");
随机获取参数:
srand(time(NULL));
rand_id=rand()%array_len+1;
sprintf(array_name,"{param_array_%d}",rand_id);
lr_save_string(lr_eval_string(array_name),"param_rand");
这样,你的随机值就存放到param_rand参数中了.
作者: wjtest    时间: 2012-1-18 15:46
学习一下




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