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:

      An XML file with variable name and value.

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:
  1. Compound test setting in the variable table UI
  2. Compound test specified in a var file
  3. User group setting in the variable table UI
  4. User group specified in a var file
  5. Schedule specified setting in the variable table UI
  6. Schedule specified in a var file
  7. 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

  1. Open the command prompt.
  2. 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
  3. 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,
    cmdline -workspace "C:/Users/HCL/hclonetest/workspace" -project "/myproj/proj123" -suite "test1.testsuite"
    OR
    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.