事务举例:如下为一个LoadRunner所生成的脚本。
web_url("Folder.jsp_4", "URL=http://172.17.16.5/xpc71/jsp/com/folder/Folder.jsp", "Resource=0", "RecContentType=text/html", "Referer=http://172.17.16.5/xpc71/LoginAction.do", "Snapshot=t10.inf", "Mode=HTML", LAST);
web_url("TemplateAdminAction.do", "URL=http://172.17.16.5/xpc71/TemplateAdminAction.do?forwardID=1", "Resource=0", "RecContentType=text/html", "Referer=http://172.17.16.5/xpc71/LoginAction.do", "Snapshot=t11.inf", "Mode=HTML", LAST);
web_submit_form("ScheduleCreationAction.do", "Snapshot=t12.inf", ITEMDATA, "Name=PTName", "Value=test", ENDITEM, "Name=headerTempID", "Value=ttte", ENDITEM, "Name=selectHeader", "Value=1", ENDITEM, "Name=schTempID", "Value=preProductionDetailTemplate", ENDITEM, LAST); |
我们插入事务之后如下所示:
lr_start_transaction("事务"); lr_start_transaction("事务1"); lr_start_transaction("事务2"); web_url("Folder.jsp_4", "URL=http://172.17.16.5/xpc71/jsp/com/folder/Folder.jsp", "Resource=0", "RecContentType=text/html", "Referer=http://172.17.16.5/xpc71/LoginAction.do", "Snapshot=t10.inf", "Mode=HTML", LAST); lr_end_transaction("事务", LR_AUTO); web_url("TemplateAdminAction.do", "URL=http://172.17.16.5/xpc71/TemplateAdminAction.do?forwardID=1", "Resource=0", "RecContentType=text/html", "Referer=http://172.17.16.5/xpc71/LoginAction.do", "Snapshot=t11.inf", "Mode=HTML", LAST); lr_end_transaction("事务1", LR_AUTO); web_submit_form("ScheduleCreationAction.do", "Snapshot=t12.inf", ITEMDATA, "Name=PTName", "Value=test", ENDITEM, "Name=headerTempID", "Value=ttte", ENDITEM, "Name=selectHeader", "Value=1", ENDITEM, "Name=schTempID", "Value=preProductionDetailTemplate", ENDITEM, LAST); lr_end_transaction("事务2", LR_AUTO); |