/*********************************************************************************************/
loadrunner 12.53 使用方法
/*********************************************************************************************/
一 环境设置
1 软件安装在 C:\Program Files (x86)\HP\LoadRunner 目录
2 在控制面板中设置JAVA 添加 the Exception Site List
a. 打开控制面板.
b. Search for Java, and double-click Java (32-bit) or Java 64-bit. The Java Control Panel opens.
c. Click the Security tab and click Edit Site List. Click Add and enter http://127.0.0.1:9080. Click
Continue to approve the address. Approve any warnings.
d. Repeat the above step and enter http://localhost:9080.
3 关闭杀毒软件(否则 脚本中会加入和 DUBA 有关的内容)
二 相关程序
1 LoadRunner:
11.0:
"C:\Program Files (x86)\HP\LoadRunner\bin\LRLauncherApp.exe"
12.53:
"C:\Program Files (x86)\HP\LoadRunner\bin\VuGen.exe"
2 LoadRunner Agent Process:
"C:\Program Files (x86)\HP\LoadRunner\launch_service\bin\magentproc.exe"
3 Start Web Server:
C:\Program Files (x86)\HP\LoadRunner\WebTours\StartServer.bat"
三 启动 WEB 服务器 (端口改为了9080 C:\Program Files (x86)\HP\LoadRunner\WebTours\conf\httpd.conf)
#Listen 12.34.56.78:80
Listen 9080
1 启动 LoadRunner Agent Process
"C:\Program Files (x86)\HP\LoadRunner\launch_service\bin\magentproc.exe"
2 Start Web Server
"C:\Program Files (x86)\HP\LoadRunner\WebTours\StartServer.bat"
四 创建脚本
1 录制 record
1) Start Recording 选项
录制到操作: Action
要录制的程序: Microsoft Internet Explorer(此处要选 C:\Program Files (x86)\Internet Explorer\iexplore.exe,否则会使用其他浏览器,发生错误 )
URL地址: http://localhost:9080/WebTours/
工作目录: C:\Program Files (x86)\HP\LoadRunner\Bin
2 回放 replay
1) 运行时设置 runtime settings
a: 一般设置 general
运行逻辑:重复次数 Run Logic : Number of iterations
步 :2次重复间的等待时间 Pacing: Start new iteration after the previous iteration ends,with fixed delay of 5 seconds
思考时间:用户在各步骤间思考的时间 Think Time:Ignore think time
日志 :希望在回放期间收集的信息的级别 Log: Log Options
Send messages: always
Detail Level: Standard log
b: 特殊设置
3 关联动态值 correlate the dynamic values
Design > Design Studio./Correlate.
4 增强
1) 定制事务
a: 确定脚本的起点和终点:Search Flights Button,reservations.pl_2
b: 在Steps Tooolbox 中选择lr_start_transaction,lr_end_transaction,双击输入事务名称
2) 参数化
View > Step Navigator/
Submit Form: reservations.pl step./
Right-click the Submit Form: reservations.pl step and select Show Arguments/
Change the fixed value to a varying value./
The Select or Create Parameter dialog box opens./
In the Parameter name box, type seat./
Click the Parameter icon adjacent to {seat} and select Parameter Properties/
Click Add Row. VuGen adds a row to the table./
3)内容检查
a:Text check
web_reg_find("Text=Find Flight",LAST);
web_reg_find("Text=Web Tours", LAST);
b:Image check
4) 如何生成调试信息
lr_output_message("The flight was booked");
5) 测试是否成功?
a:启用图像检查
4 设置负载
五 创建负载测试场景 Controller
六 如何生成重负载 Load Generator
Load Generator 是通过运行 Vuser 在应用程序中生成负载的计算机。可以使用多个
Load Generator,并在每个 Load Generator 上运行多个 Vuser。运行场景时,Controller
自动连接到 Load Generator。
七 运行负载测试场
1 开始场景
2 利用 Controller 的联机图监控性能。
1)“正在运行 Vuser - 整个场景”图。
2) “事务响应时间 - 整个场景”图。
3)“每秒点击次数 - 整个场景”图
4) “Windows 资源”图。
八 分析场景结果 Analysis
九 设置 HP Web Tours,让其出现回放错误
要演示常见的回放错误,您需要修改 HP Web Tours 应用程序中的设置。此设置
告诉 HP Web Tours Web 服务器不允许出现重复的会话 ID。
1 打开 HP Web Tours。
选择开始 > 程序 > HP LoadRunner > Samples > Web > HP Web Tours 应用
程序。浏览器将打开 HP Web Tours 的主页。
2 更改服务器选项。
a 单击 HP Web Tours 主页上的 administration (管理)链接。将打开
administration (管理)页面。
b 选择具有以下标题的复选框:Set LOGIN form's action tag to an error page.
(将 LOGIN 表单的操作标记设置为错误页面。)向下滚动到页面底部并单击
Update (更新)。
c 向下滚动到页面底部并单击 Return to the Web Tours Homepage (返回到
Web Tours 主页)链接。
此设置告诉服务器不允许出现重复的会话 ID。
3 关闭浏览器。
十 关联动态值 correlate the dynamic values
Design > Design Studio./Correlate.
十一 相关参数文件
1 城市名称
Departure City / Arrival City
Denver
Frankfurt
London
Los Angeles
Paris
Portland
San Francisco
Seattle
Sydney
Zurich
2 座位 位置
Seating Preference : Aisle / Window /None
3 机票类型
Type of Seat : First /Business /Coach
/****************************************************************************************************/
语法
/****************************************************************************************************/
1 显示 整数型数据和字符串数据
Message Formatting
Character Argument Type Printed As
d,i int decimal number
s char * print characters until either `\0' or the number of characters given in the precision is reached
lr_output_message("m
loadrunner 12.53 使用方法
/*********************************************************************************************/
一 环境设置
1 软件安装在 C:\Program Files (x86)\HP\LoadRunner 目录
2 在控制面板中设置JAVA 添加 the Exception Site List
a. 打开控制面板.
b. Search for Java, and double-click Java (32-bit) or Java 64-bit. The Java Control Panel opens.
c. Click the Security tab and click Edit Site List. Click Add and enter http://127.0.0.1:9080. Click
Continue to approve the address. Approve any warnings.
d. Repeat the above step and enter http://localhost:9080.
3 关闭杀毒软件(否则 脚本中会加入和 DUBA 有关的内容)
二 相关程序
1 LoadRunner:
11.0:
"C:\Program Files (x86)\HP\LoadRunner\bin\LRLauncherApp.exe"
12.53:
"C:\Program Files (x86)\HP\LoadRunner\bin\VuGen.exe"
2 LoadRunner Agent Process:
"C:\Program Files (x86)\HP\LoadRunner\launch_service\bin\magentproc.exe"
3 Start Web Server:
C:\Program Files (x86)\HP\LoadRunner\WebTours\StartServer.bat"
三 启动 WEB 服务器 (端口改为了9080 C:\Program Files (x86)\HP\LoadRunner\WebTours\conf\httpd.conf)
#Listen 12.34.56.78:80
Listen 9080
1 启动 LoadRunner Agent Process
"C:\Program Files (x86)\HP\LoadRunner\launch_service\bin\magentproc.exe"
2 Start Web Server
"C:\Program Files (x86)\HP\LoadRunner\WebTours\StartServer.bat"
四 创建脚本
1 录制 record
1) Start Recording 选项
录制到操作: Action
要录制的程序: Microsoft Internet Explorer(此处要选 C:\Program Files (x86)\Internet Explorer\iexplore.exe,否则会使用其他浏览器,发生错误 )
URL地址: http://localhost:9080/WebTours/
工作目录: C:\Program Files (x86)\HP\LoadRunner\Bin
2 回放 replay
1) 运行时设置 runtime settings
a: 一般设置 general
运行逻辑:重复次数 Run Logic : Number of iterations
步 :2次重复间的等待时间 Pacing: Start new iteration after the previous iteration ends,with fixed delay of 5 seconds
思考时间:用户在各步骤间思考的时间 Think Time:Ignore think time
日志 :希望在回放期间收集的信息的级别 Log: Log Options
Send messages: always
Detail Level: Standard log
b: 特殊设置
3 关联动态值 correlate the dynamic values
Design > Design Studio./Correlate.
4 增强
1) 定制事务
a: 确定脚本的起点和终点:Search Flights Button,reservations.pl_2
b: 在Steps Tooolbox 中选择lr_start_transaction,lr_end_transaction,双击输入事务名称
2) 参数化
View > Step Navigator/
Submit Form: reservations.pl step./
Right-click the Submit Form: reservations.pl step and select Show Arguments/
Change the fixed value to a varying value./
The Select or Create Parameter dialog box opens./
In the Parameter name box, type seat./
Click the Parameter icon adjacent to {seat} and select Parameter Properties/
Click Add Row. VuGen adds a row to the table./
3)内容检查
a:Text check
web_reg_find("Text=Find Flight",LAST);
web_reg_find("Text=Web Tours", LAST);
b:Image check
4) 如何生成调试信息
lr_output_message("The flight was booked");
5) 测试是否成功?
a:启用图像检查
4 设置负载
五 创建负载测试场景 Controller
六 如何生成重负载 Load Generator
Load Generator 是通过运行 Vuser 在应用程序中生成负载的计算机。可以使用多个
Load Generator,并在每个 Load Generator 上运行多个 Vuser。运行场景时,Controller
自动连接到 Load Generator。
七 运行负载测试场
1 开始场景
2 利用 Controller 的联机图监控性能。
1)“正在运行 Vuser - 整个场景”图。
2) “事务响应时间 - 整个场景”图。
3)“每秒点击次数 - 整个场景”图
4) “Windows 资源”图。
八 分析场景结果 Analysis
九 设置 HP Web Tours,让其出现回放错误
要演示常见的回放错误,您需要修改 HP Web Tours 应用程序中的设置。此设置
告诉 HP Web Tours Web 服务器不允许出现重复的会话 ID。
1 打开 HP Web Tours。
选择开始 > 程序 > HP LoadRunner > Samples > Web > HP Web Tours 应用
程序。浏览器将打开 HP Web Tours 的主页。
2 更改服务器选项。
a 单击 HP Web Tours 主页上的 administration (管理)链接。将打开
administration (管理)页面。
b 选择具有以下标题的复选框:Set LOGIN form's action tag to an error page.
(将 LOGIN 表单的操作标记设置为错误页面。)向下滚动到页面底部并单击
Update (更新)。
c 向下滚动到页面底部并单击 Return to the Web Tours Homepage (返回到
Web Tours 主页)链接。
此设置告诉服务器不允许出现重复的会话 ID。
3 关闭浏览器。
十 关联动态值 correlate the dynamic values
Design > Design Studio./Correlate.
十一 相关参数文件
1 城市名称
Departure City / Arrival City
Denver
Frankfurt
London
Los Angeles
Paris
Portland
San Francisco
Seattle
Sydney
Zurich
2 座位 位置
Seating Preference : Aisle / Window /None
3 机票类型
Type of Seat : First /Business /Coach
/****************************************************************************************************/
语法
/****************************************************************************************************/
1 显示 整数型数据和字符串数据
Message Formatting
Character Argument Type Printed As
d,i int decimal number
s char * print characters until either `\0' or the number of characters given in the precision is reached
lr_output_message("m