How to Initiate LoadTest Using an ANT Script

LegacyForumLegacyForum Posts: 1,669 ✭✭
edited December 2016 in LoadTest
I read the forum topic "How to run SOAtest from an Ant script" and in the similar way I tried initiating the loadtest using Ant Script. But it is not working.

This is how I tried :
<target name="TARGET_NAME">
<exec executable="c:\Progra~1\Parasoft\Load Test\6.1\lt.exe">
<arg value="-cmd"/>
<arg value="-runtest"/>
<arg value="c:\PATH_TO_TST_FILE\myProjectFile.tst"/>

Please provide your inputs on how to Initiate the loadtest from an ant script (or) Java code


  • LegacyForumLegacyForum Posts: 1,669 ✭✭
    edited January 2010
    Hi Siraj,

    Running LoadTest from an Ant script is very similar to running LoadTest from the command line. Here are the steps to get you set up:

    1) Open Load Test and go to Help > Documentation > Load Test Command Line Interface
    -- Follow the directions to create:
    * A script file that is used to pass to the load test executable on the command line similar to this one:
    # Load Test Script Commands for Command Line Execution

    var commandLineReports = PATH_TO_A_REPORT_DIRECTORY
    var minutes = 2

    var scenario = "Linear Increase"
    var workspace_base = C:

    open ${workspace_base}\
    loadtest -minutes ${minutes} -report ${commandLineReports}\REPORT_NAME ${scenario}

    *Important: Note the command line arguments for running Load Test: lt.exe -cmd -run PATH_TO_LOADTEST_SCRIPT
    -- These will be used in your build file that you run within ant.

    Now that you have your script created you can now go about creating the build file similar to what you originally tried except for a few changes:

    Assume the following file is called runLTFromAntScript.xml
        <target name="TARGET_NAME">
            <exec executable="PATH_TO_LT.EXE">
                <arg value="-cmd"/>
                <arg value="-run"/>
                <arg value="PATH_TO_LOADTEST_SCRIPT_FROM ABOVE"/>
    *Notice that the values in the <arg> tags are an exact replica of what is passed on the command line.

    Therefore once you have your xml file ready, you can run it on the command line from the ant/bin directory by:
    ant -f PATH_TO_BUILD_FILE/runLTFromAntScript.xml TARGET_NAME
Sign In or Register to comment.