|
我们公司要对一个网页下载进行压力测试,上网找了一下Lr无法录制到下载行为只能通过修改脚本来实现,我在网上找了一个例子,然后自己进行了修改,但是会报错,具体脚本如下:
Action()
{
web_add_cookie("rtime=9; DOMAIN=bbs.51testing.com");
web_add_cookie("ltime=1305093233625; DOMAIN=bbs.51testing.com");
web_add_cookie("cnzz_eid=45452134-1303983594-; DOMAIN=bbs.51testing.com");
web_add_cookie("cnzz_a1743488=19; DOMAIN=bbs.51testing.com");
web_add_cookie("sin1743488=none; DOMAIN=bbs.51testing.com");
web_add_cookie("xscdb_cookietime=2592000; DOMAIN=bbs.51testing.com");
web_add_cookie("smile=1D1; DOMAIN=bbs.51testing.com");
web_add_cookie("discuz_fastpostrefresh=0; DOMAIN=bbs.51testing.com");
web_add_cookie("Hm_lvt_e50ce2796571e3c3696c82ad79779b15=1305081416640; DOMAIN=bbs.51testing.com");
web_add_cookie("__utma=24129278.1613098134.1304393271.1305081281.1305081417.10; DOMAIN=bbs.51testing.com");
web_add_cookie("__utmz=24129278.1305081231.8.8.utmcsr=bbs.51testing.com|utmccn=(referral)|utmcmd=referral|utmcct=/thread-437371-1-1.html; DOMAIN=bbs.51testing.com");
web_add_cookie("cdb_sid=qiDuEq; DOMAIN=bbs.51testing.com");
web_add_cookie("cdb_oldtopics=D402D; DOMAIN=bbs.51testing.com");
web_add_cookie("xscdb_cookietime=2592000; DOMAIN=u.51testing.com");
web_add_cookie("smile=1D1; DOMAIN=u.51testing.com");
web_add_cookie("discuz_fastpostrefresh=0; DOMAIN=u.51testing.com");
web_add_cookie("Hm_lvt_e50ce2796571e3c3696c82ad79779b15=1305081416640; DOMAIN=u.51testing.com");
web_add_cookie("__utma=24129278.1613098134.1304393271.1305081281.1305081417.10; DOMAIN=u.51testing.com");
web_add_cookie("__utmz=24129278.1305081231.8.8.utmcsr=bbs.51testing.com|utmccn=(referral)|utmcmd=referral|utmcct=/thread-437371-1-1.html; DOMAIN=u.51testing.com");
web_add_cookie("cdb_sid=qiDuEq; DOMAIN=u.51testing.com");
web_add_cookie("ltime=1305094339171; DOMAIN=bbs.51testing.com");
web_add_cookie("cnzz_a1743488=20; DOMAIN=bbs.51testing.com");
web_add_cookie("sin1743488=; DOMAIN=bbs.51testing.com");
web_url("thread-100541-1-1.html",
"URL=http://bbs.51testing.com/thread-100541-1-1.html",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t346.inf",
"Mode=HTML",
EXTRARES,
"Url=/images/default/pm_ntc.gif", ENDITEM,
"Url=/templates/discuz6/images/menu_bg.gif", ENDITEM,
"Url=/templates/discuz6/images/menu_itemline.gif", ENDITEM,
"Url=/templates/discuz6/images/portalbox_bg.gif", ENDITEM,
"Url=/images/default/pmto.gif", ENDITEM,
"Url=/images/default/addbuddy.gif", ENDITEM,
"Url=/images/default/forumlink.gif", ENDITEM,
"Url=/images/default/sigline.gif", ENDITEM,
"Url=/images/default/arrow_down.gif", ENDITEM,
"Url=/images/default/arrow_right.gif", ENDITEM,
"Url=/images/default/printpost.gif", ENDITEM,
"Url=/images/default/ajaxaction.gif", ENDITEM,
"Url=/images/default/arrow_left.gif", ENDITEM,
"Url=/templates/discuz6/images/reply.gif", ENDITEM,
"Url=/images/default/tag.gif", ENDITEM,
"Url=/images/default/icon_ad.gif", ENDITEM,
"Url=/images/default/fastreply.gif", ENDITEM,
"Url=/images/default/repquote.gif", ENDITEM,
"Url=/templates/discuz6/images/newtopic.gif", ENDITEM,
"Url=/templates/discuz6/images/header_bg.gif", ENDITEM,
"Url=/images/default/text_zoom.gif", ENDITEM,
"Url=/images/default/text_common.gif", ENDITEM,
"Url=http://u.51testing.com/images/noavatar_middle.gif", ENDITEM,
"Url=/images/smilies/default/victory.gif", ENDITEM,
"Url=/images/smilies/default/kiss.gif", ENDITEM,
"Url=/images/smilies/default/handshake.gif", ENDITEM,
"Url=/images/smilies/default/time.gif", ENDITEM,
"Url=/images/smilies/default/call.gif", ENDITEM,
"Url=/images/smilies/default/dizzy.gif", ENDITEM,
"Url=/images/smilies/default/sad.gif", ENDITEM,
"Url=/images/smilies/default/loveliness.gif", ENDITEM,
"Url=/images/smilies/default/funk.gif", ENDITEM,
"Url=/images/smilies/default/curse.gif", ENDITEM,
"Url=/images/smilies/default/shutup.gif", ENDITEM,
"Url=/images/smilies/default/hug.gif", ENDITEM,
"Url=/images/smilies/default/biggrin.gif", ENDITEM,
"Url=/images/smilies/default/cry.gif", ENDITEM,
"Url=/images/smilies/default/huffy.gif", ENDITEM,
"Url=/images/smilies/default/tongue.gif", ENDITEM,
"Url=/images/smilies/default/shocked.gif", ENDITEM,
"Url=/images/smilies/default/titter.gif", ENDITEM,
"Url=/images/smilies/default/mad.gif", ENDITEM,
"Url=/images/smilies/default/shy.gif", ENDITEM,
"Url=/images/smilies/default/sweat.gif", ENDITEM,
"Url=/images/common/editor.gif", ENDITEM,
"Url=/images/smilies/default/sleepy.gif", ENDITEM,
"Url=/templates/discuz6/images/discuz_icon.gif", ENDITEM,
"Url=http://zs1.cnzz.com/stat.htm?id=1743488&r=&lg=zh-cn&ntime=0.29645100%201305093613&repeatip=20&rtime=9&cnzz_eid=45452134-1303983594-&showp=1440x900&st=1105&sin=&res=0", ENDITEM,
"Url=/pm.php?checknewpm=0.42601477265053666&inajax=1&ajaxtarget=myprompt_check", ENDITEM,
"Url=/images/default/attachinfobg.gif", ENDITEM,
LAST);
lr_start_transaction("DownLoad");
fp = fopen("c:\\oa3.doc","wb");
web_set_max_html_param_len("500000");
web_reg_save_param("FILED","LB=","RB=","Search=Body",LAST);
web_link("oa.doc",
"Text=oa.doc",
"Snapshot=t347.inf",
LAST);
i = web_get_int_property( HTTP_INFO_DOWNLOAD_SIZE );
if (i>0)
{
fwrite(lr_eval_string("{FILED}"),i,1,fp);
}
lr_think_time( 4 );
fclose(fp);
lr_end_transaction("DownLoad", LR_AUTO);
//web_link("oa.doc",
//"Text=oa.doc",
//"Snapshot=t347.inf",
//LAST);
lr_think_time(4);
web_url("360safeurl",
"URL=http://stat.360safe.com/360safeurl/?type=upnet&mid=e5eda4f6a0156d622d0b9d9ef13733e9&qn=11&es=0&ea=0&eo=0&rh0=8&rh1=2&rh2=0&rh3=0",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Mode=HTML",
LAST);
return 0;
}
在我找的例子中action前面有用到这个#include "as_web.h"我想知道这是一个什么文件,在网上没有找到相关的资料
他报这样的错误
Action.c (113): undeclared identifier `fp'
Action.c (120): undeclared identifier `i' 是因为我没有调用定义变量类型吗?请问要如何解决呢
|
|