Initializing variables from the command line
To initialize test variables from an XML file, you can run the test from the command-line interface using the varfile option.
Before you begin
-
You must read and familiar with command line parameters. See Command-line parameters.
-
You must have completed the following tasks:
-
Declared the variables using HCL OneTest™ Performance.
-
Created an XML file that contains the variables with values. The XML file would have a structure similar to the following image:
-
About this task
If a variable is initialized at various places such as test, compound test,
schedule, or user group, the product uses the following order to initialize the value of the
variable when running the test. The variable set in the variable table of the compound test
editor takes the highest precedence followed by others:
- Compound test setting in the variable table UI
- Compound test specified in a var file
- User group setting in the variable table UI
- User group specified in a var file
- Schedule specified setting in the variable table UI
- Schedule specified in a var file
- Command line
Note: You must select All tests for this user
from the Visible in drop-down list to take the precedence of variable
initialization.
Procedure
- Open the command prompt.
-
Run the following command to change the directory to the
cmdline directory:
cd <cmdline_directory_path>
For example,cd C:\Program Files\HCL\hclonetest\cmdline
Based on the operating system that you used to install HCL OneTest™ Performance, you can locate the cmdline directory as follows:
Operating system The default path to the directory Windows® C:\Program Files\HCL\hclonetest\cmdline Linux™ /opt/HCL/hclonetest/cmdline Mac /Application/HCL/hclonetest/cmdline -
Run the following command to run the test:
cmdline -workspace workspace_full_path -project proj_rel_path -suite suite_name or suite_rel_path
For example,
ORcmdline -workspace "C:/Users/HCL/hclonetest/workspace" -project "/myproj/proj123" -suite "test1.testsuite"
cmdline -workspace "C:/Users/HCL/hclonetest/workspace" -project "/myproj/proj123" -suite "Tests/test1.testsuite"
Note: You can add an additional parameter to the preceding command according to your testing requirements and then run the test.The test run starts and the status is displayed on CLI.