未来已来

老婆测试工具培训记 - LoadRunner 技巧篇 - 2

上一篇 / 下一篇  2008-08-07 17:59:06 / 个人分类:性能测试


.命令行打开LoadRunner

   在多个场景需要运行的时候,可以通过批处理循环运行场景,保存结果到指定文件夹:

   bat内容:

set LR_HOME=C:\Program Files\Mercury\LoadRunner
for /L %%iScenario   in (1,1,10) do "%LR_HOME%\bin\Wlrun.exe" -Run -TestPath "%LR_HOME%\scenario\memory_leak_crash.lrs" -ResultName C:\LR_Result\result%%iScenario

. 既可以验证请求的正确性又Vさ玫秸返氖奔?/FONT>

  由于lr的http 200的经典错误,所以需要加入验证点,如果加入了验证点,就使事务响应时间大于实际的响应时间,如何解决呢,利用lr_waste_time解决,代码如下。

   double time_elapsed, duration, waste;

   merc_timer_handle_t timer;

   lr_start_transaction("sampleTrans");

   web_url("index.htm",
           "URL=http://localhost/index.htm",
           "TargetFrame=",
           "Resource=0",
           "RecContentType=text/html",
           "Referer=",
           "Snapshot=t1.inf",
           "Mode=HTML",
           LAST);

   timer = lr_start_timer();

   // Do some checks the duration of which is not to be included in the transaction.

   web_image_check("ImgCheck1",
           "src=index_files/image002.jpg",
           LAST);

   web_image_check("ImgCheck2",
           "src=index_files/planets.gif",
           LAST);

   // How long did the tests take in seconds.

   time_elapsed = lr_end_timer(timer);

   // Convert to millisecond.s

   waste = time_elapsed * 1000;

   // Remove the time the checks took from the transaction.

   lr_wasted_time(waste);

   lr_end_transaction("sampleTrans", LR_AUTO);

 


TAG: 性能测试

 

评分:0

我来说两句

Open Toolbar