Loadrunner 系列之—-支持CI
一、命令行执行loadrunner的脚本
介绍:LoadRunner\bin\Wlrun.exe -Run -TestPath scenario.lrs -ResultName res_folder
参数说明
参数 | 说明 |
---|---|
TestPath | 场景文件的路径,如果包含空格,需要用引号括起来 |
Run | 执行场景,将所有输出消息转储到res_dir\output.txt文件中,完成之后关闭controller |
InvokeAnalysis | 在场景结束是否调用Analysis开始分析,,LoadRunner将使用场景默认设置 |
ResultName | 执行结果完整路径 |
ResultCleanName | 结果名字 |
ResultLocation | 结果文件夹 |
Controller | 命令行运行参数 |
注意上面的关系,结果的完整路径ResultName (full path) = ResultLocation (directory) + ResultCleanName (name)
实例
set LR_HOME=C:\Program Files\Mercury\LoadRunner
for /L %%i in (1,1,10) do "%LR_HOME%\bin\Wlrun.exe" -Run -TestPath "%LR_HOME%\scenario\memory_leak_crash.lrs" -ResultName C:\Temp\LR_Res\result%%i
二、命令行分析并生成结果报告
介绍:LoadRunner\bin\AnalysisUI.exe -RESULTPATH D:\test\testResult\result03\result03.lrr -TEMPLATENAME html
参数说明
参数 | 说明 |
---|---|
RESULTPATH | 执行结果路径 |
TEMPLATENAME | html |
怎么创建报告格式
首先按照需要的图表生成一个报告,然后Tools>Templates>new可以新增模板,但是要注意:
取消勾选Automatically apply this template to a new session
勾选Generate the following automatic HTML report
勾选Automatically save the session as
勾选Automatically close Analysis after saving session
三、实际范例
D:\Program Files (x86)\HP\LoadRunner\bin>wlrun.exe -Run -TestPath D:\loadrunner\Scenarios\test.lrs -ResultName D:\test\testResult\result03
D:\Program Files (x86)\HP\LoadRunner\bin>AnalysisUI.exe -RESULTPATH D:\test\testResult\result03\result03.lrr -TEMPLATENAME html
可能需要用管理员来执行
参考资料
【Quality】
Quality is the value to someone who matters。做测试,首先要找到这个someone是谁,以及这个 someone重视的 value是什么。