Most actions that can be performed from the Functional Test graphical user interface can also be performed from the command line, including:
大多数的动作可以从Functional Test 图形用户界面执行,同时也可以从它的命令行执行,包括:
· 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 涉及Java/HTML
· Invoke the Application Configuration Tool 涉及应用配置工具
The core command line format is: 命令行的格式如下:
java <standard java options> com.rational.test.ft.rational_ft <Functional Test options>
The standard java options refer to the Java command line options such as -classpath <classpath> to set the classpath appropriately or -D to define a system property. Either the JRE associated with this command needs to be enabled by Functional Test, or the following options must be set:
· -classpath
must be specified to explicitly include the rational_ft.jar
from the Functional Test install directory and
· -Drational_ft.install.dir=<Functional Test install directory>
must be set to allow Functional Test to initialize correctly.
If the JRE is enabled by Functional Test, these options are not necessary.
See the Functional Test API Reference (com/rational/test/ft/rational_ft) for a full list of the command-line options.
The more commonly used options include:
· -datastore
<datastore directory>
is needed whenever a script is specified, for example with -record
or -playback
.
· -record
<script name>
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, based on the project type.
· -playback
<script name>
to play back a specific Java script.
· -edit
<file>
or -display
<file>
to edit or view a Functional Test 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
to display the enabler GUI or enable a specific environment.
· -appconfig
to display the Application Configuration Tool.
· -inspector
to display the Test Object Inspector Tool.
Here are some examples of command-line usage:
In these examples, -classpath
must point to the rational_ft.jar files.
Note: The <script-name> values use standard Java package or .NET namespace naming conventions such aspackage.MyScript
or Namespace.MyScript
.
Record a new script:
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> [-map<sharedmap>] [options] -record <script-name>
Record into an existing script, inserting before or after a given line:
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> [-insertbefore <line>] [-insertafter <line>] [options] -record <script-name>
Compile a script:
Note: The java compiler is no longer installed with Functional Test. You must install JRE and add the bin directory to the path.
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> [options] -compile <script-name>
Play back a script, passing command-line arguments <values> to the script:
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> -log<logname> [options] -playback <script-name> [-args <values>]
Record, compile, and play back a script:
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> [options] -record <script-name> -compile -playback [-args <values>]
Construct an empty script:
java -Drational_ft.install.dir=<Rational FT install directory> -classpath<classpath> com.rational.test.ft.rational_ft -datastore <directory> -map<sharedmapname> [options] -create <script-name>
Running Functional Test in unattended batch mode
If you have TestManager installed and you want to run Functional Test unattended in batch mode with a TestManager log, you must include the following options on the rational_ft command line:
-user username
The TestManager user name for login.
-password password
Optional. The TestManager password for login. Do not use this if there is no password.
-project fullpath and full projectname
The name of the TestManager project, which is preceded by its full path. This is case-sensitive.
-build build
The name of an existing TestManager build. See Note below.
-logfolder foldername
The name of an existing TestManager log folder (see Note below) or the file specification for an HTML or a text log. If you use the HTML or text log folder name, you do not need to specify the build.
Note: If you want to create a TestManager log, make sure you create the TestManager build and the TestManager log folders first. See the note about TestManager integration at the end of this topic. If these two folders do not exist, execution will fail when you run Functional Test unattended in batch mode.
-log logname
The name of the TestManager, HTML or text log. If you use the HTML or text log name, you do not need to specify the build.
Example:
java -Drational_ft.install.dir="C:/Program Files/IBM/Rational/Software Development Platform/6.0/FunctionalTester/eclipse/plugins/com.rational.test.ft.wswplugin_6.1.0" -classpath "C:/Program Files/IBM/Rational/Software Development Platform/6.0/FunctionalTester/eclipse/plugins/com.rational.test.ft.wswplugin_6.1.0/rational_ft.jar" com.rational.test.ft.rational_ft -datastore //My_project/AUser/RobotJProjects -user admin -project //My_project/AUser/TestManagerProjects/Test.rsp -build "Build 1" -logfolder "Default" -log "Al_SimpleClassicsA#1" -rt.log_format "TestManager" -rt.bring_up_logviewer true -playback basetests.SimpleClassicsA_01
If you do not want TestManager to display the log after playing the script, you must also include the following option on the rational_ft command line:
-rt.bring_up_logviewer false
Note About TestManager Integration
Functional Test is integrated with Rational TestManager version 2003.06.13. If you have the 2003.06.13 version of TestManager, you will be able to use the integrated features of Functional Test and TestManager. Please seeUnderstanding Functional Test Product Packaging and Integrations for important information on using the products together.