通過RFT命令列執行測試指令碼
RFT提供了命令列介面的指令碼執行方式,例如下面的例子執行了D:/RFT/RFT_Project/Calc_FunctionLib專案中的TestControl指令碼:
java -classpath "C:/Program Files/IBM/SDP/FunctionalTester/bin/rational_ft.jar" com.rational.test.ft.rational_ft -datastore "D:/RFT/RFT_Project/Calc_FunctionLib" -playback TestControl
其中classpath選項用於指定rational_ft.jar的路徑,有時我們在自動化測試框架中會引入第三方jar包,那麼也把jar包的路徑寫進去。
datastore選項用於指定指令碼的專案檔案目錄。
playback選項用於指定要回放的指令碼檔名,不要跟Java字尾名。
下面內容摘自RFT幫助文件:
Most actions that can be performed from the Functional Tester 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 呼叫Java/HTML啟用器
- Invoke the Application Configuration Tool 呼叫應用程式配置工具
命令列呼叫格式
The core command line formats follow:
java <standard java options> -classpath rational_ft.jar com.rational.test.ft.rational_ft <Functional Tester options> or
java <standard java options> -jar rational_ft.jar <Functional Tester 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 rational_ft.jar in the classpath. It can be found in the Functional Tester install directory. If you use the second command-line format, specify the full path of the rational_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 Functional Tester with PurifyPlus™, use the first command-line format.
See the Functional Tester API Reference (com/rational/test/ft/rational_ft) for a full list of the command-line options.
-projectpath
If you have dependencies on a projects, then you must add the project path using the -projectpath option.
常用選項
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 -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 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.
命令列使用例子
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 as package.MyScript or Namespace.MyScript.
Record a new script:
java -classpath <classpath> com.rational.test.ft.rational_ft -datastore <directory> [ -map <sharedmap>] [options] -record <script-name>
Record a simplified script:
java -classpath <classpath> com.rational.test.ft.rational_ft -simplescript true -datastore <directory> [-map<sharedmapname>] [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, passing command-line arguments <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 uses other classes for the functional test projects:
java -projectpath <projectpath> 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 true before -playback in 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
無人值守批處理模式
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:
-user username
The TestManager user name for login.
-password password
Optional. The TestManager password for login. Do not use this if no password has been set.
-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. If these two folders do not exist, execution will fail when you run Functional Tester 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.
Windows命令列呼叫例子
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
在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 above command-line format, you must explicitly set the functional tester environment variables. Alternatively, you can use the Functional Tester scriptft_cmdline.
Linux命令列呼叫例子
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
相關文章
- 在RFT中如何通過指令碼獲取已新增到某個指令碼中的測試物件?指令碼物件
- Jmeter 通過命令列 (CLI) 模式執行測試示例與引數詳解JMeter命令列模式
- 通過 Redis 定時執行指令碼Redis指令碼
- node 執行JavaScript 指令碼 測試axiosJavaScript指令碼iOS
- shell指令碼命令 執行python檔案&python命令列執行python程式碼指令碼Python命令列
- unittest 單元測試框架教程 1-執行測試指令碼框架指令碼
- 通過shell指令碼監控sql執行頻率指令碼SQL
- 通過Linux crontab 定期執行Oracle Procedure 指令碼LinuxOracle指令碼
- 通過spid,查詢執行慢的sql指令碼SQL指令碼
- 通過Python指令碼理解系統執行緒薦Python指令碼執行緒
- 通過錄制指令碼進行壓測,生成的測試報告真的有價值嗎?指令碼測試報告
- xcall叢集執行命令指令碼指令碼
- seleniumGrid分散式遠端執行測試指令碼分散式指令碼
- Roundcube 1.2.2:通過郵件執行命令
- 通過API執行AutoCAD命令來…API
- QTP測試指令碼的維護 - 使用Update執行模式和Maintenance執行模式QT指令碼模式AINaN
- cmd命令列下用命令執行SQL指令碼到SQL Server資料庫中命令列SQL指令碼Server資料庫
- Linux 定時執行指令碼、命令Linux指令碼
- 通過shell指令碼來得到不穩定的執行計劃指令碼
- 通過命令列在Python中測試以太坊RPC客戶端命令列PythonRPC客戶端
- 通過命令列在 Python 中測試以太坊 RPC 客戶端命令列PythonRPC客戶端
- Linux命令執行時間測試Linux
- 在 Linux 命令列指令碼中執行 sudo 時自動輸入密碼Linux命令列指令碼密碼
- IDEA 執行 XXX 時報錯命令列過長,縮短命令列並重新執行Idea命令列
- shell指令碼linux命令連續執行指令碼Linux
- 在RFT中使用Excel進行資料驅動測試Excel
- Windos bat批處理指令碼,判斷是終端命令列執行,還是雙擊執行BAT指令碼命令列
- 通過shell指令碼檢測MySQL服務資訊指令碼MySql
- Go執行指令碼命令用例及原始碼解析Go指令碼原始碼
- 如何測試Linux命令執行時間?Linux
- 命令列執行Nunit命令列
- TortoiseSVN 命令 (命令列執行工具)命令列
- linux 上 jenkins 通過節點服務在 windows 執行指令碼LinuxJenkinsWindows指令碼
- MySQL執行外部sql指令碼檔案的命令MySql指令碼
- linux指令碼完成重複執行的命令Linux指令碼
- Linux後臺執行指令碼命令之nohupLinux指令碼
- LINUX 自動執行指令碼的命令配置Linux指令碼
- 執行 測試