Submit and vote on feature ideas.

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 run LoadTest from an Ant Script

Options
LegacyForum
LegacyForum 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:
CODE
#
# Load Test Script Commands for Command Line Execution
#

var minutes = 2

var scenario = "Linear Increase"

open PATH_TO_LT_FILE\LOAD_TEST_FILE_NAME.lt
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
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 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
Tagged: