This topic explains how you to run a existing load test tests from the command line interface.
Starting the Load Test Server on Remote Machines
Load Test Server must be running on the the same remote machines that the tests will run on.
Windows
To start the Load Test Server on a Windows machine, enter a command in the format:
Windows: lt -loadtestserver [portnumber]
For example:lt -loadtestserver 10095
Note | ||
---|---|---|
| ||
For your command, enter the port number that is appropriate for your test setup. |
Linux/Mac
To start the Load Test Server on a Linux/Mac machine, enter a command in the format:
loadtest -loadtestserver [portnumber]
For example:loadtest -loadtestserver 10095
Note | ||
---|---|---|
| ||
For your command, enter the port number that is appropriate for your test setup. |
Working with Load Test Machines Located on Different Networks
The machine that runs in GUI mode and provides the interface for controling the load test is the Load Test controller machine. The controller can communicate with a Load Test server machine located on a different network if the network equipment that bridges these networks allows communication on the port that the Load Test server machine is listening on.
For example, if you run your Load Test controller on network A and your Load Test server is started on port 10095 by an lt -loadtestserver 10095
command on network B, the communication on port 10095 between networks A and B must not restricted by your network equipment. Allow any TCP traffic exchange for that port. Talk to your system or network administrator about the network configuration issues.
Running Load Tests
Create In this section:
Table of Contents | ||
---|---|---|
|
Running Load Tests
You can run existing load test (.lt) files from the Load Test command line interface. The Load Test command line runs a script that specifies which .lt file files to open and how to run the test. Invoke the script whenever you want to run the testtests.
...
Creating the Script
The script file must be saved Create a plain text file with UTF-8 character encoding and add the commands to run your load test. Your system may create text files using another character encoding standard. If you experience issues running your script, verify that the correct encoding is used. Create a text file that contains a command Write your script in the following format:
Code Block |
---|
open FilePath loadtest [-version] [-localSettings path_to_local_settings_file] [-env environment_name] [-minutes number] [-vus number | -hps number] [-teamServer path_inside_team_server] [-report path_to_report_file] [-html html_directory] ScenarioName<PATH-TO-LT-FILE> loadtest <OPTIONS> <SCENARIO-NAME> |
The loadtest
command runs a test suite load test using the specified scenario. See the Refer to the Load Test Command Reference table below for the list and description of the details about the available loadtest command options.
Using Variables
...
You can declare and variables that you want to use variables in the script . A variable can be declared in using the following waysyntax:
Code Block |
---|
var VariableName1 = VariableValue var VariableName2 = "Variable Value with Spaces" |
An already-declared variable can be assigned a new name in the following wayYou can reassign variables that have been declared earlier in the script:
Code Block |
---|
var VariableName1 = NewVariableValue |
...
Code Block |
---|
# # Using script commands # var report-home = C:\CONTINUOUS_LOAD_TEST\ENTERPRISE_LOAD_TEST var minutes = 1 var scenario = "Steady Load" var base = tests/loadtester/accuracytest/tests var category = Accuracy var test-name = 1-Profile-HPS open ${base}/${test-name}.lt loadtest -minutes ${minutes} -allReports ${report-home}/%d/${category}/${test-name} ${scenario} |
...
Running the Script
...
Invoke Load Test from the command line
...
to run the script:
Code Block | ||
---|---|---|
| ||
lt.exe -cmd -run |
...
<PATH_TO_YOUR_SCRIPT> // WINDOWS
./loadtest -cmd -run <PATH_TO_YOUR_SCRIPT> // Linux and macOS |
The -cmd
argument starts Load Test in command line mode, while the . The -run argument executes the specified Load Test script. Both arguments are required to run a script from the command line.
Code Block | ||
---|---|---|
| ||
lt.exe -cmd -run <PATH_TO_YOUR_SCRIPT> // WINDOWS ./loadtest -cmd -run <PATH_TO_YOUR_SCRIPT> // Linux and macOS |
Requesting a License Dynamically
When you run Load Test in command line mode, Load Test uses the license configured in the GUI mode by default. You can also dynamically request a license from a Parasoft License Server with the -licenseserver
option. Specify the host and port of the License Server and use the -licenseVus
option to specify the number of virtual users allowed by the license.
Code Block | ||
---|---|---|
| ||
lt.exe -cmd -run <PATH_TO_YOUR_SCRIPT> -licenseserver <HOST>:<PORT> -licenseVus <INTEGER> // WINDOWS
./loadtest -cmd -run <PATH_TO_YOUR_SCRIPT> -licenseserver <HOST>:<PORT> -licenseVus <INTEGER> // Linux and macOS |
Examples
Code Block |
---|
-licenseserver LicenseServerHost:2002 -licenseVus 100 // Requests a 100-VU Load Test license
-licenseserver LicenseServerHost:2002 -licenseVus Unlimited // Requests an Unlimited VU Load Test license
-licenseserver LicenseServerHost:2002 // Requests basic 5-VU Load Test license |
Running Load Test on Remote Machines
You can run load tests on a remote machine from the command line by starting the remote instance of Load Test in server mode and running a project with the local instance of Load Test that is configured to run the tests on the remote server.
Starting Load Test in Server Mode
Use the -loadtestserver
flag and specify the port number to enable the Load Test to run remotely. The port number is the local machines's port on which the server is listening.
Code Block | ||
---|---|---|
| ||
lt -loadtestserver <PORT> // WINDOWS
./loadtest -loadtestserver <PORT> // Linux and macOS |
Configuring a Remote Project
See Running Load Tests on Remote Machines for instructions.
Working with Load Test Machines Located on Different Networks
The machine that runs in GUI mode and provides the interface for controling the load test is the Load Test controller machine. The controller can communicate with a Load Test server machine located on a different network if the network equipment that bridges these networks allows communication on the port that the Load Test server machine is listening on.
For example, if you run your Load Test controller on network A and your Load Test server is started on port 10095 by an lt -loadtestserver 10095
command on network B, the communication on port 10095 between networks A and B must not restricted by your network equipment. Allow any TCP traffic exchange for that port. Talk to your system or network administrator about the network configuration issues.
Load Test Command Reference
Anchor | ||||
---|---|---|---|---|
|
The following commands allow you to start the Load Test Server and run load tests:
Load Test
...
Command Line Options
Use these commands in either the Windows Command Prompt or a Linux shell.
...
Windows
lt -loadtestserver [server number]
...
Scroll Table Layout | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Option | Description |
---|---|
-cmd | Starts Load Test in command line mode. Required to run Load Test locally. |
-run | Specifies the Load Test script to run. Required to run Load Test locally. |
-licenseserver <HOST>:<PORT> | Specifies the host name or IP address and port of the machine on which Parasoft License Server is installed. By default, Load Test requests a license from the server configured in the GUI, but this option enables you to dynamically request a license. Optional. |
-licenseVus <VALUE> | Specifies the number of virtual users allowed by the license requested from the server specified with the -licenseserver option. You can specify an integer value or unlimited for unlimited virtual users licenses. |
| Starts the Load Test Server on the specified port number. To start the Load Test Server on port 8999, you would specify the port number in the command line argument such as:
|
Load Test Script Commands
Scroll Table Layout | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Command | Option & option arguments | Description |
---|---|---|
var | Format: Declares a variable name and assigns it a value. Use ${variable_name} syntax to get the variable value. | |
open | Format: Opens the specified project in Load Test. After a project is loaded, use the loadtest command. | |
loadtest | Format: Runs a test suite load test using the specified scenario and options. See the rows below for details. | |
-localSettings path_to_local_settings_file | Specifies the path to the local settings file, which contains configuration and preferences parameters (see Local Settings Files). | |
-env environment_name | Sets the active environment. Environments are a part of the SOAtest project that are used by the Load Test. | |
-minutes number | Specifies the test duration in minutes. If you specify a test duration in this command, it will override the test duration specified in the scenario. | |
-vus number | Sets the number of virtual users for each machine in the load test configuration to the given Number. The execution mode is switched to "Weighted Profiles" mode and each machine in the load test configuration is configured to run a steady load with the specified number of virtual users. | |
-hps number | Sets the number of hits per second for each machine in the load test configuration to the given Number. The execution mode is switched to "Weighted Profiles" mode and each machine in the load test configuration is configured to run a steady load with the specified number of hits per second. | |
-teamServer path_inside_team_server | Sends the necessary reports to the Team Server under the specified path. Uses the Team Server that is speci-fied in the local settings file. If no local settings are specified, uses the Team Server specified in the Load Test preferences. See Load Test Continuum for more details and examples. -tcm path_inside_team_ser ver is deprecated but supported. | |
-report path_to_report_file | Specifies that you want to create a binary report with the given name | |
-html html_directory | Specifies that you want to create an HTML report with the given name in the specified directory. | |
-allReports reportsPath | Specifies that you want to create a binary, XML and HTML report under the given directory path. | |
-trimReportSeconds headSeconds tailSeconds | Specifies the duration (in seconds) to be trimmed from the beginning and the end of the report*. The seconds values must be non-negative integers. If the sum of the headSeconds and tailSeconds values is greater than the duration of the report, the trim operation will not be applied. | |
-trimReportPercentage headPercentage tailPercentage | Specifies the duration (in a percentage relative to the duration of the report) to be trimmed from the beginning and the end of the report*. The percentages must be non-negative integers. If the sum of the headPercentage and tailPercentage is equal to or greater than 100, the trim operation will not be applied. |
...