Command line interface

In this section, you will learn about the actions that can also be performed from the command line.

These actions include:

  • Record a script
  • Compile a script
  • Play back a script and pass command-line arguments to the script
  • View and edit verification point and object map files
  • Invoke the Java/HTML enabler
  • Invoke the Application Configuration Tool

Core command line format

The core command line format is as follows:

java <standard java options> -classpath hcl_ft.jar com.rational.test.ft.rational_ft <product options> or
java <standard java options> -jar hcl_ft.jar <product options>

The standard java options refer to the Java command line options such as -classpath <classpath/> to set the classpath appropriately.

-classpath
If you use the first command line format, you must explicitly include the hcl_ft.jar in the classpath. It can be found in the <Install_Directory> directory. If you use the second command-line format, specify the full path of the hcl_ft.jar file after the -jar option. You do not need to specify a classpath or the class to run (com.rational.test.ft.rational_ft ). If you are using the product with PurifyPlus, use the first command line format.
Note: If the external jar file or directory that is referenced in a project does not meet the project path criteria, then such jar files must be added to the classpath.

See the API Reference for a full list of the command line options.

-projectpath
If you have dependencies on a project, then you must add the project path using the -projectpath option. If you have added other project dependencies to the functional test project, you can specify the project name using the -projectpath option. For example, Consider a scenario where you have a functional test script that uses a class from another project. To resolve this dependency, during a command line invocation, you must specify the dependent project name using the -projectpath option.
In a scenario where you have added external jar files or projects to a Test UI project and the playback for this is run from the command line prompt then add the jar file to the project path provided the jar file contains a Test UI project or the project that is added is a Test UI project.

Commonly used command line options

The following table lists the more commonly used command line options:
Parameter Description
-appconfig Use this option to open the Application Configuration Tool dialog.
-compile Use this option to compile the test script for the first time before playback.
-compileall Use this option to compile all test scripts in the project for the first time before playback. If you use the -datastore option, you can compile all tests scripts in the datastore directory and subdirectories. (Requires 9.1.1.1 and newer version of Test UI)
-datastore <datastore directory> Use this option whenever a script is specified. For example, use it with -record or -playback
-edit <file> or -display <file> Use this option to edit or view a verification point or object map. The <file> can be a complete file name (with directory path). Use double-quotes if the name or path includes space characters.
-enable Use this option to open the Enable Environments dialog to enable a specific environment.
-exportlog Optional. You can use this parameter to specify the file directory path to store the exported test log.

For example,

java -jar "C:\Program Files\HCL\DevOpsTest\FunctionalTester\bin\hcl_ft.jar" -datastore "C:\Users\user\HCL\devopstest\workspace\FunctionalTesterDemo" -playback "ClassicsJava_FindBasedScript" -exportlog "C:\result\temp_rft01"

-exportReport Use this option to export the unified report of Functional tests to the file formats such as PDF, HTML, and XML.
Note: The exported XML file is a JUnit XML file. You can view this file in applications that support JUnit reporting formats.

The command syntax is as follows:

exportReport "type=<reporttype>;format=<file type1,file type2,file type3>;folder<destination folder path>;filename=<name of the exported file>

For example, to export the report to only the pdf format, you can use exportReport "type=unified;format=pdf;folder=Exportedreport102;filename=testreport

If you want to export the report to multiple formats, you can specify the file formats as comma-separated values. The file type value can be in uppercase or lowercase.

For example, to export the report to all the supported formats, you can use exportReport "type=unified;format=pdf,xml,html;folder=Exportedreport102;filename=testreport

The report in different file formats use the same file name that is specified in the command.

-inspector Use this option to open the Test Object Inspector Tool dialog.
-playback <script name> Use this option to play back a Java script. You must specify the playback option at the end of the command. Test UI ignores any arguments specified after the playback option.
-record <script name> Use this option to record a new script (or in conjunction with -insertafter <line number> to insert recording into an existing script). .
-rt.log_format Optional.
Use this option to specify the format of the report that you want to generate after the playing back of a test. You can specify any of the following log types as the format of the report:
  • none
  • text
  • html
  • TPTP
  • xml
  • Default
  • Json
Restriction: If you use Default as the log type to generate unified report for Functional test scripts from the command line, the report does not open automatically when the play back is completed. You must use a different log type if you want the report to open automatically when the play back is completed.
Tip: You can use the -exportlog parameter to export the test log in the Default log type format.
Note: The script name in the above options is not a file name. It is a fully qualified class name using the dot (.) character to separate package/namespace and script class name. You can use -<option> <script name> to record a Java™ or VB.NET script, depending on the project type.

For example, you can use -record test.script1 to create the test folder in a project and create the script1 Java™ script in the folder.

Command line usage in Linux®

The command line format is <Install_Directory>/jdk/jre/bin/java <Install_Directory>/FunctionalTester/bin/hcl_ft.jar <product options>. If the product is installed in the default path, then the you can use /opt/HCL/DevOpsTest/jdk/jre/bin/java /opt/HCL/DevOpsTest/FunctionalTester/bin/hcl_ft.jar <product options>.

If you use the above command-line format, you must explicitly set the functional test environment variables. Alternatively, you can use the script ft_cmdline.

Examples:

Enable all environments in Linux®

/opt/HCL/DevOpsTest/ft_cmdline -enable ALL

Execute a script with command line arguments on Linux®

/opt/HCL/DevOpsTest/ft_cmdline -datastore /home/user/HCL/devopstest/workspace/Project1 -log testscript -playback Script2 -args arg1 arg2