HTML-based script和URL-based Script模式
来源:互联网 发布:淘宝购物车服务出错 编辑:程序博客网 时间:2024/06/16 17:28
选择Tools-Recording Options,打开设置页面
针对Web(HTTP/HTML)协议,Loadrunner提供两种录制方式,HTML-based script和URL-based Script模式。默认情况下,Loadrunner选择的是“HTML-based script”
HTML-based script:为每个用户请求生成单独的函数
URL-based Script:捕获所有作为用户操作的结果发送给服务器的HTTP请求,并一一记录
测试用例:
步骤
步骤描述
预期结果
1
打开飞机订票系统登录页面
2
输入用户名“jojo”,密码“bean”点击“Login”
3
点击“Sign Off”
4
关闭页面
使用两种录制方式录制的脚本分别如下:
HTML-Based script
/*HTML_Based*/
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
lr_think_time(9);
web_submit_form("login.pl",
"Snapshot=t2.inf",
ITEMDATA,
"Name=username","Value=jojo", ENDITEM,
"Name=password","Value=bean", ENDITEM,
"Name=login.x","Value=60", ENDITEM,
"Name=login.y","Value=7", ENDITEM,
LAST);
web_image("SignOffButton",
"Alt=SignOffButton",
"Snapshot=t3.inf",
LAST);
return0;
URL-Based Script
/*URL_Based*/
web_url("WebTours",
"URL=http://127.0.0.1:1080/WebTours/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t4.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("header.html",
"URL=http://127.0.0.1:1080/WebTours/header.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/",
"Snapshot=t5.inf",
"Mode=HTTP",
LAST);
web_url("welcome.pl",
"URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/",
"Snapshot=t8.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("hp_logo.png",
"URL=http://127.0.0.1:1080/WebTours/images/hp_logo.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t6.inf",
LAST);
web_url("webtours.png",
"URL=http://127.0.0.1:1080/WebTours/images/webtours.png",
"Resource=1",
"RecContentType=image/png",
"Referer=http://127.0.0.1:1080/WebTours/header.html",
"Snapshot=t7.inf",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("home.html",
"URL=http://127.0.0.1:1080/WebTours/home.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Snapshot=t9.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl",
"URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=true",
"Snapshot=t10.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_url("mer_login.gif",
"URL=http://127.0.0.1:1080/WebTours/images/mer_login.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t11.inf",
LAST);
lr_think_time(8);
web_submit_data("login.pl",
"Action=http://127.0.0.1:1080/WebTours/login.pl",
"Method=POST",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Snapshot=t12.inf",
"Mode=HTTP",
ITEMDATA,
"Name=userSession","Value=104960.867557716fDQiQctpzcfDcDQDpftHHf", ENDITEM,
"Name=username","Value=jojo", ENDITEM,
"Name=password","Value=bean", ENDITEM,
"Name=JSFormSubmit","Value=off", ENDITEM,
"Name=login.x","Value=54", ENDITEM,
"Name=login.y","Value=9", ENDITEM,
LAST);
web_concurrent_start(NULL);
web_url("login.pl_2",
"URL=http://127.0.0.1:1080/WebTours/login.pl?intro=true",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t13.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl_2",
"URL=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/login.pl",
"Snapshot=t14.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
web_concurrent_start(NULL);
web_url("flights.gif",
"URL=http://127.0.0.1:1080/WebTours/images/flights.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t15.inf",
LAST);
web_url("in_home.gif",
"URL=http://127.0.0.1:1080/WebTours/images/in_home.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t16.inf",
LAST);
web_url("itinerary.gif",
"URL=http://127.0.0.1:1080/WebTours/images/itinerary.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t17.inf",
LAST);
web_url("signoff.gif",
"URL=http://127.0.0.1:1080/WebTours/images/signoff.gif",
"Resource=1",
"RecContentType=image/gif",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t18.inf",
LAST);
web_concurrent_end(NULL);
web_url("SignOffButton",
"URL=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/nav.pl?page=menu&in=home",
"Snapshot=t19.inf",
"Mode=HTTP",
LAST);
web_concurrent_start(NULL);
web_url("home.html_2",
"URL=http://127.0.0.1:1080/WebTours/home.html",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",
"Snapshot=t20.inf",
"Mode=HTTP",
LAST);
web_url("nav.pl_3",
"URL=http://127.0.0.1:1080/WebTours/nav.pl?in=home",
"Resource=0",
"RecContentType=text/html",
"Referer=http://127.0.0.1:1080/WebTours/welcome.pl?signOff=1",
"Snapshot=t21.inf",
"Mode=HTTP",
LAST);
web_concurrent_end(NULL);
return0;
- HTML-based script和URL-based Script模式
- LR中,URL -based script与HTML -based script区别
- LoadRunner Html-based script模式和Ur-based scriptl模式的区别
- LR中HTML-based Script/URL-based Script选择的小规则
- loadrunner 脚本录制-录制选项设置HTML-based URL-based Script
- HTML-based模式和URL-based模式的区别
- HTML-based模式和URL-based模式的区别
- LoadRunner录制模式之html-based和URL-based区别
- LoadRunner录制模式之html-based和URL-based区别
- URL-based 方式和 HTML-based方式的差别
- Rule-based DoS attacks prevention shell script LG #137
- unity树形结构(Script Based Runtime Tree-View Control)
- HTML Script
- RAM-Based和HIVE-Based
- three20-URL based Navigation
- script
- script
- script
- JPA mysql中text字段的映射
- Windows XP 常见的进程列表
- FieldByName速度优化
- 修改版本信息
- Seo优化1
- HTML-based script和URL-based Script模式
- sicily 1029
- 昨天的搞得问题的总结
- Oracle管理方面的3个近期汇总整理
- LoadRunner脚本参数化
- HttpClient 异常出现不关闭引发的血案
- MSN 天空软件版的bug
- Struts2 stuts.xml 简单配置
- 现实的100句话