How to run LoadTest from an Ant Script

LegacyForumLegacyForum Posts: 1,664 ✭✭
edited December 2016 in Load Test
It is very similar to running Load Test from the command line.

1) Open Load Test and go to Help > Documentation > Load Test Command Line Interface (cli)
-- Follow the directions to create a script that calls the .lt file and provides specific parameters for a scenario similar to this one:
# Load Test Script Commands for Command Line Execution

var minutes = 2

var scenario = "Linear Increase"

loadtest -minutes ${minutes} -report PATH_TO_REPORT_DIRECTORY\REPORT_NAME ${scenario}

-- In the documentation: Note how Load Test is called from the command line once your script is written: lt.exe -cmd -run LOAD_TEST_SCRIPT
-- This will be helpful in writing the build file.

2) Now assuming the Load Test script is ready and that you already have a build file, you can enter the following inside the build file:

Assume this build 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 for the <arg> tags are exactly the same to those passed on the command line.
-- Once this is set you are ready to run Load Test from an ant script by executing the following on the command line within the ant/bin directory:

ant -f PATH_TO_BUILD_FILE/runLTFromAntScript.xml TARGET_NAME
Sign In or Register to comment.