努力工作,把握幸福。

RFT: Command-line

上一篇 / 下一篇  2011-02-25 12:17:09 / 个人分类:RFT

RFT 自身提供了 command-line 的功能,可以实现大部分RFT界面可以实现的功能,如:

  • Compile a script.
  • Play back a script, passingcommand-linearguments to the script.
  • View and edit verification point and object map files
  • Invoke the Java/HTML enabler
  • Invoke the Application Configuration Tool
  • RFT帮助文档中,对这方面也进行了深入阐述,通过command-line 也可以实现无人值守的批处理执行RFT Scripts。

    Core command line format

    The core command line formats follow:

    java<standard java options>-classpathrational_ft.jarcom.rational.test.ft.rational_ft<Functional Tester options>or
    java<standard java options>-jarrational_ft.jar<Functional Tester options>

    Thestandard java optionsrefer to the Java™ command line options such as-classpath <classpath>to set the classpath appropriately.

    -classpath
    If you use the firstcommand-lineformat, you must explicitly include therational_ft.jarin the classpath. It can be found in the Functional Tester install directory. If you use the secondcommand-lineformat, specify the full path of therational_ft.jarfile after the-jaroption. You do not need to specify a classpath or the class to run (com.rational.test.ft.rational_ft ). If you are using Functional Tester with PurifyPlus™, use the firstcommand-lineformat.

    See the Functional Tester API Reference (com/rational/test/ft/rational_ft) for a full list of thecommand-lineoptions.

    Commonly used options

    The following is the list of more commonly used options:

    -datastore<datastore directory>
    Use this option whenever a script. is specified, for example use it with-recordor-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.
    -edit <file>or-display <file>
    Use this option to edit or view a Functional Tester 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.
    -inspector
    Use this option to open the Test Object Inspector Tool dialog box.

    Command-lineusage examples

    In these examples,-classpathmust point to the rational_ft.jar files.

    Note:The <script-name> values use standard Java package or .NET namespace naming conventions such aspackage.MyScriptorNamespace.MyScript.

    Record a new script.:

    java-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-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory> [-insertbefore<line>] [-insertafter<line>] [options]-map<sharedmap>] [options]-record<script-name>

    Compile a script.:

    Note:You must enable the Java environment before compiling a script. with this command. You must also install Java SDK and add the bin directory to the path.
    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory> [options]-compile<script-name>

    Play back a script, passingcommand-linearguments <values> to the script.:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-log<logname> [options]-playback<script-name> [-args<values>]

    Play back a script. that uses classes from other functional test projects:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-projectpath<reference-project-path>-playback<script-name>

    Play back a script. that has an associated datapool:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-iterationCount<iteration value>-playback<script-name>

    Record, compile, and play back a script.:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory> [options]-record<script-name>-compile -playback[-args<values>]
    Note:To playback your scripts with dynamic VPs, add-rt.interative truebefore-playbackin the command line.

    Construct an empty script.:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-map<sharedmapname> [options]-create<script-name>

    Regenerate the helper file for a script.:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-helper<script-name>

    Regenerate all helper files for a datastore:

    java-classpath<classpath> com.rational.test.ft.rational_ft-regenHelpers<script-name>

    Display an object-map file:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-display<object-map filename>

    Display a verification-point file:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-display<verification point filename>

    Edit an object-map file:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-edit<object-map filename>

    Edit a verification-point file:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-edit<verification point filename>

    Create and edit a shared-object map:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-fromMap<object-map filename1>-createMap<object-map filename2>

    Merge a later version of an object map into a current (modified) version of the same map:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-from<object-map filename1>-to<object-map filename2>-original<object-map filename1>-mergeMap

    Compare an actual verification point result to an expected verification point result:

    java-classpath<classpath> com.rational.test.ft.rational_ft-datastore<directory>-baseline<baseline verification point filename>-compare<expected verification point filename> <actual verification point filename>

    Enable a configured browser, Java environment, or Eclipse platform.:

    java-classpath<classpath> com.rational.test.ft.rational_ft-enableName<browser/Java environment/Eclipse>

    Disable all configured browsers, Java environments and Eclipse platforms:

    java-classpath<classpath> com.rational.test.ft.rational_ft-disableall

    Run the Application Configuration Tool:

    java-classpath<classpath> com.rational.test.ft.rational_ft-appConfig<application name>

    Run the Test Object Inspector:

    java-classpath<classpath> com.rational.test.ft.rational_ft-inspector

    Run the Object Properties Configuration Tool:

    java-classpath<classpath> com.rational.test.ft.rational_ft-objectlibraryou

    Running Functional Tester in unattended batch mode

    If you have TestManager installed and you want to run Functional Tester unattended in batch mode with a TestManager log, you must include the following options on the rational_ft command line:

    -userusername
    The TestManager user name for login.
    -passwordpassword
    Optional. The TestManager password for login. Do not use this if no password has been set.
    -projectfullpath and full projectname
    The name of the TestManager project, which is preceded by its full path. This is case-sensitive.
    -buildbuild
    The name of an existing TestManager build. See Note below.
    -logfolderfoldername
    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. If these two folders do not exist, execution will fail when you run Functional Tester unattended in batch mode.
    -loglogname
    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.

    Examples:

    Execute a script. on Windows®

    java -classpath "C:\IBM\RFT\FunctionalTester\bin\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

    Command line usage in Linux

    The command line format is:/opt/IBM/RFT/jre/bin/java/opt/IBM/RFT/FunctionalTester/bin/rational_ft.jar<Functional Tester options>

    If you use the abovecommand-lineformat, you must explicitly set the functional tester environment variables. Alternatively, you can use the Functional Tester scriptft_cmdline.

    Examples:

    Enable all environments in Linux®

    /opt/IBM/SDP7.0/ft_cmdline -enable ALL

    Execute a script. with command line arguments on Linux

    /opt/IBM/SDp7.0/ft_cmdline -datastore 
    /opt/IBM/RFT/workspace/Project1 -log testscript. -playback Script2 -args arg1 arg2

    TAG:

     

    评分:0

    我来说两句

    Open Toolbar