思考时间的理解处理

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

用户访问某个网站或软件,一般不会不停地做个各种操作,例如一次查询,用户需要时间查看查询的结果是否是自己想要的。例如一次订单提交,用户需要时间核对自己填写的信息是否正确等。

也就是说用户在做某些操作时,是会有停留时间的,我把这个时间叫思考时间。但利用代码去执行的时候是没有时间的,当然,脚本运行本身是需要时间的,但比起人的思考时间要小很多。这也是我们为什么要用软件来代替人的某些工作。

但有时候,我们在做性能测试时,为了更真实的模拟用户的操作,需要给代码加入思考时间。来看看在loadrunner是如何设置思考时间的。

打开loadrunner 的Virtual User Generator

菜单栏:Vuser ---Run-Time settings...,切换到Thark Time选项

好吧!为了更好的理解这个界面上设置,现在我们通过一个脚本来分析。

Action()

{

double trans_time; //定义变量

web_url("",

"URL=/",

"Resource=0",

"RecContentType=text/html",

"Referer=",

"Snapshot=t1.inf",

"Mode=HTML",

LAST);

web_url("i-1.0.0.png",

"URL=/r/www/img/i-1.0.0.png",

"Resource=1",

"RecContentType=image/png",

"Referer=/",

"Snapshot=t2.inf",

LAST);

web_url("favicon.ico",

"URL=/favicon.ico",

"Resource=1",

"RecContentType=image/x-icon",

"Referer=",

"Snapshot=t3.inf",

LAST);

web_url("su",

"URL=/su?wd=&cb=window.bdsug.sugPreRequest&sid=14 66&t=1362316450913",

"Resource=1",

"RecContentType=baiduapp/json",

"Referer=/",

"Snapshot=t4.inf",

LAST);

lr_start_transaction("注册"); //添加事务

lr_think_time(20); //设置思考时间

web_url("v.gif",

"URL=/v.gif?pid=201&pj=www&rsv_sid=1466&fm=behs&tab= tj_reg&un=&path=http%3A%2F%%2F&t=1362316485456",

"Resource=1",

"Referer=/",

LAST);

web_url("favicon.ico_2",

"URL=https:///favicon.ico",

"Resource=1",

"RecContentType=application/octet-stream",

"Referer=",

"Snapshot=t5.inf",

LAST);

web_link("注册",

"Text=注册",

"Snapshot=t6.inf",

LAST);

web_custom_request("urs.asmx",

"URL=https:///urs.asmx?MSURS-Client-Key=WI0pAZHPdb%2b3UDOD0 AtzxA%3d%3d&MSURS-Patented-Lock=S1IpDfNCCC4%3d",

"Method=POST",

"Resource=0",

"RecContentType=text/xml",

"Referer=",

"Snapshot=t7.inf",

"Mode=HTML",

"EncType=text/xml; charset=utf-8",

"Body=

v=\"3\">ED8654D5-B9F0-4DD9-B3E8-F8F560086FDFF03F2D77-79E1-4DEC-BBF 8-81A5C07901609.0.8110.09.00.8112.164216.1.7601.1.09.0.8112.16421zh-CNaHR0cHM6Ly9wYXNzcG9ydC5iYWlkd S5jb20vdjIvP3JlZyZyZWdUeXBlPTEmdHBsPW1uJnU9aHR0cCUzQSUyRiUyRnd3dy5iYWlkdS5jb 20lMkY=PRETOP220.181.111.48",

EXTRARES,

"Url=https:///img/topbarnav_bg.png",

"Referer=https:///v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2F %2F", ENDITEM,

"Url=https:///passApi/js/reg_6e270622.js",

"Referer=https:///v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2F %2F", ENDITEM,

"Url=https:///passApi/img/small_blank_9dbbfbb1.gif", "Referer=https:///v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2F %2F", ENDITEM,

LAST);

web_url("api",

"URL=https:///v2/api/?getapi&tpl=mn&apiver=v3&tt=136231649 1971&class=reg&callback=bd__cbs__c93h6w",

"Resource=0",

"RecContentType=text/html",

"Referer=https:///v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2F %2F",

"Snapshot=t8.inf",

"Mode=HTML",

EXTRARES,

"Url=/img/v.gif?type=1®Type=mail",

"Referer=https:///v2/?reg®Type=1&tpl=mn&u=http%3A%2F%2F %2F", ENDITEM,

LAST);

相关文档
最新文档