分类:
2008-10-15 16:44:27
LoadRunner中HTTP的录制及两种录制模式的比较
一,脚本编写
1, “HTML –base scrīpt”和“URL-base scrīpt”的区别
1)“HTML –base scrīpt”默认模式,为每个用户请求生成单独的函数
如:
Action()
{
web_url("WebTours",
"URL=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTML",
LAST);
web_submit_form("login.pl",
"Snapshot=t5.inf",
ITEMDATA,
"Name=username", "Value=jojo", ENDITEM,
"Name=password", "Value=bean", ENDITEM,
"Name=login.x", "Value=53", ENDITEM,
"Name=login.y", "Value=13", ENDITEM,
LAST);
return 0;
}
2)“URL-base scrīpt”可以捕获所有作为用户操作的结果发送到的HTTP请求,然后一一记录下来。可以捕获非HTML应用程序,例如小程序和非浏览器应用程序。
如:
Action()
{
web_url("WebTours",
"URL=",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("header.html",
"URL=header.html",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t2.inf",
"Mode=HTTP",
LAST);
web_url("welcome.pl",
"URL=welcome.pl?signOff=true",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t5.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("hp_logo.png",
"URL=images/hp_logo.png",
"Resource=1",
"RecContentType=image/png",
"Referer=header.html",
"Snapshot=t3.inf",
LAST);
web_url("webtours.png",
"URL=images/webtours.png",
"Resource=1",
"RecContentType=image/png",
"Referer=header.html",
"Snapshot=t4.inf",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
[1]