Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to Initiate LoadTest Using an ANT Script

LegacyForum
LegacyForum Posts: 1,664 ✭✭
edited December 2016 in Load Test
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 :
****************
<project>
<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"/>
</exec>
</target>
</project>

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

Comments

  • LegacyForum
    LegacyForum Posts: 1,664 ✭✭
    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:
    CODE
    #
    # 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}\LOAD_TEST_FILE_NAME.lt
    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
    CODE<project>
        <target name="TARGET_NAME">
            <exec executable="PATH_TO_LT.EXE">
                <arg value="-cmd"/>
                <arg value="-run"/>
                <arg value="PATH_TO_LOADTEST_SCRIPT_FROM ABOVE"/>
            </exec>
        </target>
    </project
    *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