事务,N个操作的集合叫事务。LR中事务标记点
成对出现,事务中不可以存在其他东西,如检查点、思考时间、集合点等其他函数,因为事务会统计这些时间,导致事务时间统计不准确!!!!
#添加事务
1.鼠标选择要插入的位置 2.点击插入
输入开始的事务标记点
名称
1.鼠标选择要插入的事务结束标记点的位置,2.点击插入
输入结束的事务标记点
名称(跟开始的事务标记点名称要相同,他们是成对出现的)
生成的代码:
Action()
{
lr_start_transaction("login"); //事务开始
web_custom_request("web_custom_request",
"URL=https://puxx.com", //保密,XXX显示
"Method=GET",
"TargetFrame=",
"Resource=0",
"Referer=",
"EncType=application/json",
"Body=",
LAST);
lr_end_transaction("login", LR_AUTO);//事物结束
}
执行后,会显示这个事务耗费的时间,常用于压测过程中,统计这个事务的响应时间。比如这里是登录操作,如果没有将其标记为事务,那么压测过程中,响应时间报表就不会展示登录这个事务的响应时间!!!
Action.c(6): Found resource "https://pubxxxuy.com/js/app.76ea026f.js" in HTML "https://pubxxxbuy.com" [MsgId: MMSG-26659]
Action.c(6): Found resource "https://pubxxxuy.com/js/chunk-vendors-legacy.ff0651b9.js" in HTML "https://puxxx.com" [MsgId: MMSG-26659]
Action.c(6): Found resource "https://pubxxxy.com/js/app-legacy.93cf913e.js" in HTML "https://puxxxy.com" [MsgId: MMSG-26659]
Action.c(6): web_custom_request("web_custom_request") was successful, 889499 body bytes, 4831 header bytes [MsgId: MMSG-26386]
Action.c(17): Notify: Transaction "login" ended with "Pass" status (Duration: 1.4678 Wasted Time: 0.3864).
Ending action Action.
Ending iteration 1.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.
Duration:事物开始到结束总的时间,包含wasted time
wasted time:是整个事务中函数自身执行所消耗的时间