2008-03-01

How to run LoadRunner Controller from command line?

Today I will explain how to open and run LoadRunner Controller scripts from command line.
This feature can decrease tester's manual efforts and thereby to increase your effectiveness and performance.

You can open LoadRunner Controller scenario with:

LoadRunner\bin\Wlrun.exe -Run -TestPath scenario.lrs -ResultName res_folder


For example:
(note: click the image to enlarge it)

As a result of above command, LoadRunner Controller:
  • starts
  • opens Controller scenario
  • executes it
  • saves results to folder 'C:\Temp\LR_Res\result_0'
After that, Controller finishes working and closes.
Please, see files from created 'C:\Temp\LR_Res\result_0' folder:
Tips: As you see, there is LoadRunner Result file (result_0.lrr). You can pass it automatically to LoadRunner Analysis for further processing.
Refer for detailed information: Custom HTML report in LoadRunner Analysis from command line.

Actually, Wlrun.exe can have several settings. There are their descriptions from HP LoadRunner Controller User's Guide (© HP/Mercury Interactive):
TestPathPath to the scenario.
For example, C:\LoadRunner\scenario\Scenario.lrs
If the path includes blank spaces, use quotation marks.
RunRuns the scenario, dumps all output messages into res_dir\output.txt and closes Controller
InvokeAnalysisInstructs LoadRunner to invoke Analysis upon scenario termination. If this argument is not specified, LoadRunner uses the scenario default setting.
ResultNameFull results path. For example, "C:\Temp\Res_01"
ResultCleanNameResults name. For example, "Res_01"
ResultLocationResults directory. For example, "C:\Temp"
Note: ResultName (full path) = ResultLocation (directory) + ResultCleanName (name)

Well, let's see different variants of how to open and run LoadRunner Controller script:

Open LoadRunner Controller:
Wlrun.exe

Open LoadRunner Controller scenario 'scenario.lrs' and do not execute it:
Wlrun.exe -TestPath scenario.lrs

Open LoadRunner Controller scenario 'scenario.lrs', execute it, and save results to default folder ('C:\Documents and Settings\user_login\Local Settings\Temp\res'):
Wlrun.exe -Run -TestPath scenario.lrs

Open LoadRunner Controller scenario 'scenario.lrs', execute it, and save results to 'res_folder' folder:
Wlrun.exe -Run -TestPath scenario.lrs -ResultName res_folder

Open LoadRunner Controller scenario 'scenario.lrs', execute it, save results to 'res_folder' folder, and after that start Analysis on created results with default template:
Wlrun.exe -Run -TestPath scenario.lrs -ResultName res_folder -InvokeAnalysis


And please see more complex example for desert :)

Open LoadRunner Controller scenario 'scenario.lrs', execute it, save results to 'res_folder' folder, and after that start Analysis on created results with default template. Repeat all these steps 10 times:
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

Result is:


Well, where to use execution from a command line?
It can be very useful in some cases, when you plain to:
  • run LoadRunner Controller and pass its results to LoadRunner Analysis
  • run LoadRunner scripts by schedule

Thank you, dear readers.
Any questions and comments? Welcome :)
--
Dmitry



Related articles:

20 comments:

  1. Hi Dimtry,
    I am new to LR. I learning LR. Could you please guide me what step do we need to take before recoding Web applilcations. For Eg., What the Tools ->Internet Options -> Connections -> ..
    What do we need to check here for recording an Intranet apps? Proxy settings?

    ReplyDelete
  2. 2Srikanth:
    Usually, you can set the same Recording Internet connection options as for Internet Explorer.

    ReplyDelete
  3. Hi Dmitry Sir

    I want to know about Performance Test Plan Document and who to create it, what are the objects in the test plan, what are the things we need to collect (requirement) from the client? How to distribute load between tasks.
    and
    For example I am having 100 Vuser license. Can I run more then 100 V users? Any possibility. (Because I face this question every time )
    If you post it I will be thank full to you.
    My email id is saikiran.ganti@gmail.com

    ReplyDelete
  4. Hi Dmitry,

    Could you explain us explain on bandwidth throttling in LR.

    Suppose I need simulate the load test with real world internet network bandwidth like 100 KBPS or 200 KBPS between the client and server.

    How to simulate using different network speeds in Loadrunner.

    An article on this would be really better.

    Vasanth.

    ReplyDelete
  5. Hi,
    This is kanda.
    I have tried to run controller from Cmdprompt as by your comments "C:\Programfiles\Mercury\Loadrunner\bin>wlrun.exe -Run -Testpath scenario.lrs -Resultname res_fol -Invokeanalysis" when I tried,it invokes controller,but its not running the scenario,not invoking the analysis.I have windows XP Proffesional.
    So can u give me idea how to check it

    ReplyDelete
  6. 2Kanda:
    You should specify the full path to your scenario.

    For example:
    -Testpath C:\folder\scenario.lrs

    ReplyDelete
  7. Hi Dimtry!!

    I want to program with scripts by Java and convert Web Vuser Scripts into Java. Could you please tell me what step i need to do.
    Thank you very much.

    ReplyDelete
  8. 2BAD^-^BOY:
    Have you already Web scripts in C?
    Did you modified/edited them or not?
    Why do you plan to convert them into Java?

    ReplyDelete
  9. No, i have recorded a Web script by VuGen. And my teacher wants me: convert it to Java script.

    ReplyDelete
  10. No, i have recorded a Web script by VuGen. And my teacher wants me: convert it into Java script.

    ReplyDelete
  11. 2BAD^-^BOY:
    Please, read Document #12739 (How to convert a C-Web Vuser script to a Java Vuser script) from HP Knowledge Base.

    ReplyDelete
  12. Hi Dmitry,

    Could u please explain what is the difference in running the scripts on the LR Controller in scenario mode and group mode? when we go for scenario mode and when for group mode?

    ReplyDelete
  13. hi dimtry,
    can u explain abt how to monitor weblogic resources

    ReplyDelete
  14. I've been given the task of automating the testing procedure as much as possible, which will necessarily mean running the Controller from the command line. I'm unable to understand the return codes (as indicated by %ERRORLEVEL%) that I'm seeing (eg. 2, even with successful completion). Any assistance would be appreciated.

    ReplyDelete
  15. 2Anonymous,
    This is explained in LR Help.
    I do not want to copy-paste it.

    ReplyDelete
  16. 2Anonymous,
    I can't 'cause I didn't work with weblogic.

    ReplyDelete
  17. 2Anonymous (from August 13, 2008 4:53 AM),
    So, what is your question?

    ReplyDelete
  18. HI Sir,

    This is Maheshwar.
    The way explain things are very good. We could understand very easily and in my projects as well.Thanks

    Regards
    Maheshwar S

    ReplyDelete
  19. Hi Dmitriy,

    In my scenario I have several load generator machines, is there any way to connect them before exection using the batch file previosly shown?

    Thanks in advance.

    ReplyDelete
  20. Hello Dmitry,

    Likewise, I am unable to understand the return codes (as indicated by %ERRORLEVEL%). Would you please provide the name of the help file (chm or pdf) that the information is contained in... I cannot find it anywhere. We have LR v9.10.

    ReplyDelete