loadrunner12.00的基础使用 您所在的位置:网站首页 pl浏览器 loadrunner12.00的基础使用

loadrunner12.00的基础使用

2024-06-27 02:10| 来源: 网络整理| 查看: 265

一、loadrunner VuGer原理

        (1)录制:录制url或应用程序发出的请求和服务器响应,将之录下生成脚本

        (2)回放:模拟真实用户发出请求

以loadrunner自带订票软件为例:

1、首先需要启动,安装软件时的“Start HP Web Tours Server”,

表示服务启动成功

2、浏览器访问网址“http://127.0.0.1:1080/WebTours/”,展示HP Web Tours的主页,表示服务已启,可正常访问网址

二、脚本的录制 1、创建空的Vuser脚本

①双击桌面快捷图标,打开VuGer

②文件-新建脚本,打开创建脚本对话框

③即:创建一个空Vuser脚本

2、录制Vuser脚本

①单击“录制”按钮,打开“录制对话框”

录制弹窗打开

②录制弹窗输入目标网址信息

③展示此浮窗后,浏览器打开网址,进行常规操作(登录登录、查找航班、付款、退出系统)

④结束录制后,生成代码

作者录制代码,可参考

Action() { web_add_cookie("MSO=SID&1694415542; DOMAIN=127.0.0.1"); web_add_cookie("MTUserInfo=firstName&Jojo&address2&&username&jojo&hash&47&lastName&Bean%0A&address1&&creditCard&&expDate&%0A; DOMAIN=127.0.0.1"); web_url("WebTours", "URL=http://127.0.0.1:1080/WebTours/", "TargetFrame=", "Resource=0", "Referer=", "Snapshot=t1.inf", "Mode=HTML", LAST); web_url("welcome.pl", "URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=true", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/WebTours/", "Snapshot=t2.inf", "Mode=HTML", LAST); web_url("nav.pl", "URL=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=true", "Snapshot=t3.inf", "Mode=HTML", LAST); lr_rendezvous("登录集合点"); lr_think_time(10); lr_start_transaction("登录事务"); web_submit_data("login.pl", "Action=http://127.0.0.1:1080/cgi-bin/login.pl", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home", "Snapshot=t4.inf", "Mode=HTML", ITEMDATA, "Name=userSession", "Value=137255.215876873HAzAAzfpVzzzzzzHtcDzApDQV", ENDITEM, "Name=username", "Value=jojo", ENDITEM, "Name=password", "Value=bean", ENDITEM, "Name=login.x", "Value=19", ENDITEM, "Name=login.y", "Value=11", ENDITEM, "Name=JSFormSubmit", "Value=off", ENDITEM, LAST); web_url("login.pl_2", "URL=http://127.0.0.1:1080/cgi-bin/login.pl?intro=true", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/login.pl", "Snapshot=t5.inf", "Mode=HTML", LAST); web_url("nav.pl_2", "URL=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/login.pl", "Snapshot=t6.inf", "Mode=HTML", LAST); lr_end_transaction("登录事务",LR_AUTO); lr_think_time(4); web_url("welcome.pl_2", "URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?page=search", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=home", "Snapshot=t7.inf", "Mode=HTML", LAST); web_url("nav.pl_3", "URL=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=flights", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?page=search", "Snapshot=t8.inf", "Mode=HTML", LAST); web_url("reservations.pl", "URL=http://127.0.0.1:1080/cgi-bin/reservations.pl?page=welcome", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?page=search", "Snapshot=t9.inf", "Mode=HTML", LAST); lr_think_time(12); lr_start_transaction("航班查询"); web_submit_data("reservations.pl_2", "Action=http://127.0.0.1:1080/cgi-bin/reservations.pl", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl?page=welcome", "Snapshot=t10.inf", "Mode=HTML", ITEMDATA, "Name=advanceDiscount", "Value=0", ENDITEM, "Name=depart", "Value=London", ENDITEM, "Name=departDate", "Value=09/12/2023", ENDITEM, "Name=arrive", "Value=Paris", ENDITEM, "Name=returnDate", "Value=09/13/2023", ENDITEM, "Name=numPassengers", "Value=1", ENDITEM, "Name=seatPref", "Value=Aisle", ENDITEM, "Name=seatType", "Value=Coach", ENDITEM, "Name=findFlights.x", "Value=26", ENDITEM, "Name=findFlights.y", "Value=6", ENDITEM, "Name=.cgifields", "Value=roundtrip", ENDITEM, "Name=.cgifields", "Value=seatType", ENDITEM, "Name=.cgifields", "Value=seatPref", ENDITEM, LAST); lr_end_transaction("航班查询",LR_AUTO); lr_think_time(12); web_submit_data("reservations.pl_3", "Action=http://127.0.0.1:1080/cgi-bin/reservations.pl", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl", "Snapshot=t11.inf", "Mode=HTML", ITEMDATA, "Name=outboundFlight", "Value=240;108;09/12/2023", ENDITEM, "Name=numPassengers", "Value=1", ENDITEM, "Name=advanceDiscount", "Value=0", ENDITEM, "Name=seatType", "Value=Coach", ENDITEM, "Name=seatPref", "Value=Aisle", ENDITEM, "Name=reserveFlights.x", "Value=55", ENDITEM, "Name=reserveFlights.y", "Value=9", ENDITEM, LAST); lr_think_time(27); lr_start_transaction("支付"); web_submit_data("reservations.pl_4", "Action=http://127.0.0.1:1080/cgi-bin/reservations.pl", "Method=POST", "TargetFrame=", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/reservations.pl", "Snapshot=t12.inf", "Mode=HTML", ITEMDATA, "Name=firstName", "Value=Jojo", ENDITEM, "Name=lastName", "Value=Bean", ENDITEM, "Name=address1", "Value=", ENDITEM, "Name=address2", "Value=", ENDITEM, "Name=pass1", "Value=Jojo Bean", ENDITEM, "Name=creditCard", "Value=12345678", ENDITEM, "Name=expDate", "Value=0911", ENDITEM, "Name=oldCCOption", "Value=", ENDITEM, "Name=numPassengers", "Value=1", ENDITEM, "Name=seatType", "Value=Coach", ENDITEM, "Name=seatPref", "Value=Aisle", ENDITEM, "Name=outboundFlight", "Value=240;108;09/12/2023", ENDITEM, "Name=advanceDiscount", "Value=0", ENDITEM, "Name=returnFlight", "Value=", ENDITEM, "Name=JSFormSubmit", "Value=off", ENDITEM, "Name=buyFlights.x", "Value=57", ENDITEM, "Name=buyFlights.y", "Value=8", ENDITEM, "Name=.cgifields", "Value=saveCC", ENDITEM, LAST); lr_end_transaction("支付",LR_AUTO); lr_think_time(20); lr_start_transaction("退出"); web_url("welcome.pl_3", "URL=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/nav.pl?page=menu&in=flights", "Snapshot=t13.inf", "Mode=HTML", LAST); web_url("nav.pl_4", "URL=http://127.0.0.1:1080/cgi-bin/nav.pl?in=home", "TargetFrame=", "Resource=0", "RecContentType=text/html", "Referer=http://127.0.0.1:1080/cgi-bin/welcome.pl?signOff=1", "Snapshot=t14.inf", "Mode=HTML", LAST); lr_end_transaction("退出",LR_AUTO); return 0; } 三、回放脚本 1、编译脚本 2、回放时设置,后续会有详解

3、回放信息,截图代表正在回放ing

4、回放结果展示



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

      专题文章
        CopyRight 2018-2019 实验室设备网 版权所有