Command line interface

In this section, you will learn all the actions from the graphical user interface can also be performed from the command line.

These actions include:

  • Record a script
  • Compile a script
  • Play back a script, passing 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 formats follow:

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

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

If you use the first command-line format, you must explicitly include the rational_ft.jar in the classpath. It can be found in the install directory. If you use the second command-line format, specify the full path of the 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 (com/rational/test/ft/rational_ft) for a full list of the command-line options.

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 Rational® Functional Tester 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 Rational® Functional Tester project or the project that is added is a Rational® Functional Tester project.

Commonly used command line options

The following table lists the more commonly used command line options:
Table 1. Command line options
Parameter Description
-datastore <datastore directory> Use this option whenever a script is specified. For example, use it with -record or -playback
-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).

The script name 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 -record <script name> to record Java or VB.NET scripts, depending on the project type

-playback <script name> Use this option to play back a Java script. You must specify the playback option at the end of the command. Rational® Functional Tester ignores any arguments specified after the playback option.
-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 box to enable a specific environment.
-appconfig Use this option to open the Application Configuration Tool dialog box.
-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.
-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\IBM\SDP\FunctionalTester\bin\rational_ft.jar" -datastore "C:\Users\user\IBM\rationalsdp\workspace\FunctionalTesterDemo" -playback "ClassicsJava_FindBasedScript" -exportlog "C:\result\temp_rft01"

-inspector Use this option to open the Test Object Inspector Tool dialog box.
-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 and newer)