典型的登录脚本
上一篇 / 下一篇 2015-12-18 15:50:01 / 个人分类:性能测试
Action()
{
//集合点
//lr_rendezvous("login");
lr_start_transaction("登录");
web_reg_find("Text=欢迎",
"SaveCount=select_count",
"Search=All",
LAST);
web_submit_data("logon",
"Action=http://{IP}/account/logon",
"Method=POST",
"RecContentType=text/html",
"Referer=http://{IP}/Account/LogOn?ReturnUrl=%2f",
"Snapshot=t69.inf",
"Mode=HTTP",
ITEMDATA,
"Name=LoginName", "Value={username}", ENDITEM,
"Name=Password", "Value=000000", ENDITEM,
LAST);
lr_start_transaction("登录后的资源下载");
web_url("Page.css",
"URL=http://{IP}/Content/Page.css",
"Resource=1",
"RecContentType=text/css",
"Referer=http://{IP}/",
"Snapshot=t71.inf",
LAST);
web_url("stealer.js",
"URL=http://{IP}/Scripts/stealer.js",
"Resource=1",
"RecContentType=application/x-javascript",
"Referer=http://{IP}/",
"Snapshot=t72.inf",
LAST);
web_url("jquery-ui-1.9.2.custom.min.css",
"URL=http://{IP}/Content/ui-lightness/jquery-ui-1.9.2.custom.min.css",
"Resource=1",
"RecContentType=text/css",
"Referer=http://{IP}/",
"Snapshot=t74.inf",
LAST);
web_url("common.js",
"URL=http://{IP}/Scripts/common.js",
"Resource=1",
"RecContentType=application/x-javascript",
"Referer=http://{IP}/",
"Snapshot=t76.inf",
LAST);
web_url("popup.js",
"URL=http://{IP}/Scripts/popup.js",
"Resource=1",
"RecContentType=application/x-javascript",
"Referer=http://{IP}/",
"Snapshot=t79.inf",
LAST);
web_url("jquery-ui-1.9.2.custom.min.js",
"URL=http://{IP}/Scripts/jquery-ui-1.9.2.custom.min.js",
"Resource=1",
"RecContentType=application/x-javascript",
"Referer=http://{IP}/",
"Snapshot=t81.inf",
LAST);
web_url("icon_07.png",
"URL=http://{IP}/Content/images/icon_07.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t83.inf",
LAST);
web_url("icon_06.png",
"URL=http://{IP}/Content/images/icon_06.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t84.inf",
LAST);
web_url("choice_bg.gif",
"URL=http://{IP}/Content/images/choice_bg.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://{IP}/",
"Snapshot=t86.inf",
LAST);
web_url("head_bg.jpg",
"URL=http://{IP}/Content/images/head_bg.jpg",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://{IP}/",
"Snapshot=t87.inf",
LAST);
web_url("icon_01_active.png",
"URL=http://{IP}/Content/images/icon_01_active.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t88.inf",
LAST);
web_url("logo_stu.png",
"URL=http://{IP}/Content/images/logo_stu.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t90.inf",
LAST);
web_url("a0b674be-85e7-4dff-b006-f81c6b63c228.jpg",
"URL=http://{IP}/UploadFile/thumbnail/a0b674be-85e7-4dff-b006-f81c6b63c228.jpg",
"Resource=1",
"RecContentType=image/jpeg",
"Referer=http://{IP}/",
"Snapshot=t92.inf",
LAST);
web_url("subnav_active_bg.gif",
"URL=http://{IP}/Content/images/subnav_active_bg.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://{IP}/",
"Snapshot=t96.inf",
LAST);
web_url("icon_03.png",
"URL=http://{IP}/Content/images/icon_03.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t99.inf",
LAST);
web_url("icon_02.png",
"URL=http://{IP}/Content/images/icon_02.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t100.inf",
LAST);
web_url("icon_05.png",
"URL=http://{IP}/Content/images/icon_05.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t103.inf",
LAST);
web_url("icon_04.png",
"URL=http://{IP}/Content/images/icon_04.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://{IP}/",
"Snapshot=t104.inf",
LAST);
lr_end_transaction("登录后的资源下载",LR_AUTO);
if(atoi(lr_eval_string("{select_count}"))>0)
{
lr_end_transaction("登录",LR_PASS);
}
else
{
lr_end_transaction("登录",LR_FAIL);
lr_error_message("前台登陆失败:%s",lr_eval_string("{username}"));
}
return 0;
}
TAG: