Run Scripts Through The Rational Functional Tester Command Line PDF
Run Scripts Through The Rational Functional Tester Command Line PDF
command line
Run, create, or record Java or .NET script
IBM Rational Functional Tester is an automated testing tool that runs functional, regression,
GUI, and data-driven tests. This article provides ready-to-use batch files that software testers
can use to run Java or .NET scripts through the Rational Functional Tester command line. It
concludes with tips for using the command line to create and record scripts.
Important:
The order of the arguments is significant.
Listing 3. Batch file to run the Rational Functional Tester Java script
: Disclaimer that this batch file is created for Rational Functional Tester
:version 8.0 on the Operating System Windows XP
: Usage of the batch file
:e.g. RFT_PlayScript ProjectPath ScriptName LogName [silent]
@ECHO OFF
:start
:save_args_as_variables
set RFT_PROJECT_LOCATION=%1
set RFT_SCRIPT_NAME=%2
set RFT_LOGFILE_NAME=%3
goto check_args
:check_args
if "%RFT_PROJECT_LOCATION%" == "" goto missing_args
if "%RFT_SCRIPT_NAME%" == "" goto missing_args
if "%RFT_LOGFILE_NAME%" == "" goto missing_args
goto args_ok
:args_ok
if "%4" == "silent" goto playback
echo.
echo RFT_PROJECT_LOCATION = %RFT_PROJECT_LOCATION%
echo RFT_SCRIPT_NAME = %RFT_SCRIPT_NAME%
echo RFT_LOGFILE_NAME = %RFT_LOGFILE_NAME%
echo IBM_RATIONAL_RFT_ECLIPSE_DIR = %IBM_RATIONAL_RFT_ECLIPSE_DIR%
echo IBM_RATIONAL_RFT_INSTALL_DIR = %IBM_RATIONAL_RFT_INSTALL_DIR%
echo.
echo Initializing RFT Playback...
:playback
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%\jdk\jre\bin\java"
-classpath "%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.jar"
Parameters passed here are the location of the project, the name of the script to run, and the
name of the log file.
For example, suppose that you have a project named SampleProject at C:\SampleWorkSpace,
and a script called SampleScript. In this situation:
To run this batch file from command prompt, go to the location where this batch is present. For the
example in Figure 1, assuming that this batch file PlayBack.bat file is at the command prompt: c:\
Run scripts through the Rational Functional Tester command line Page 2 of 6
ibm.com/developerWorks/ developerWorks
:start
:save_args_as_variables
set RFT_PROJECT_LOCATION=%1
set RFT_SCRIPT_NAME=%2
set RFT_LOGFILE_NAME=%3
goto check_args
:check_args
if "%RFT_PROJECT_LOCATION%" == "" goto missing_args
if "%RFT_SCRIPT_NAME%" == "" goto missing_args
if "%RFT_LOGFILE_NAME%" == "" goto missing_args
goto args_ok
:args_ok
if "%4" == "silent" goto playback
echo.
echo RFT_PROJECT_LOCATION = %RFT_PROJECT_LOCATION%
echo RFT_SCRIPT_NAME = %RFT_SCRIPT_NAME%
echo RFT_LOGFILE_NAME = %RFT_LOGFILE_NAME%
echo IBM_RATIONAL_RFT_INSTALL_DIR = %IBM_RATIONAL_RFT_INSTALL_DIR%
echo.
echo Initializing RFT Playback...
:playback
"%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.exe" -datastore
%RFT_PROJECT_LOCATION% -playback %RFT_SCRIPT_NAME%
-language vb -log %RFT_LOGFILE_NAME%
:missing_args
echo.
echo ERROR: Invalid syntax! Usage:
echo RFT_PlayScript ProjectPath ScriptName LogName [silent]
echo.
pause
goto end
:end
Run scripts through the Rational Functional Tester command line Page 3 of 6
developerWorks ibm.com/developerWorks/
@ECHO OFF
:start
:save_args_as_variables
set RFT_PROJECT_LOCATION=%1
set RFT_SCRIPT_NAME=%2
set RFT_LOGFILE_NAME=%3
set RFT_Argument =%4
goto check_args
:check_args
if "%RFT_PROJECT_LOCATION%" == "" goto missing_args
if "%RFT_SCRIPT_NAME%" == "" goto missing_args
if "%RFT_LOGFILE_NAME%" == "" goto missing_args
goto args_ok
:args_ok
if "%4" == "silent" goto playback
echo.
echo RFT_PROJECT_LOCATION = %RFT_PROJECT_LOCATION%
echo RFT_SCRIPT_NAME = %RFT_SCRIPT_NAME%
echo RFT_LOGFILE_NAME = %RFT_LOGFILE_NAME%
echo IBM_RATIONAL_RFT_ECLIPSE_DIR = %IBM_RATIONAL_RFT_ECLIPSE_DIR%
echo IBM_RATIONAL_RFT_INSTALL_DIR = %IBM_RATIONAL_RFT_INSTALL_DIR%
echo.
echo Initializing RFT Playback...
:playback
"%IBM_RATIONAL_RFT_ECLIPSE_DIR%\jdk\jre\bin\java"
-classpath "%IBM_RATIONAL_RFT_INSTALL_DIR%\rational_ft.jar"
com.rational.test.ft.rational_ft -datastore
%RFT_PROJECT_LOCATION%
-playback %RFT_SCRIPT_NAME% -log %RFT_LOGFILE_NAME%
[-agrs %RFT_Argument%]
if "%5" == "silent" goto end
echo RFT playback complete.
goto end
:missing_args
echo.
echo ERROR: Invalid syntax! Usage:
echo RFT_PlayScript ProjectPath ScriptName LogName [silent]
goto end
:end
Run scripts through the Rational Functional Tester command line Page 4 of 6
ibm.com/developerWorks/ developerWorks
Listing 10. Record into an existing script, inserting before or after a given line
rational_ft.exe -datastore <directory> -[ -insertbefore <line>]
[ -insertafter <line>] [options] -map <sharedmap>]
[options] -record <script-name>
Note:
You must enable the Java environment before compiling a script with this command. You must also
install the Java SDK and add the bin directory to the path.
Run scripts through the Rational Functional Tester command line Page 5 of 6
developerWorks ibm.com/developerWorks/
Related topics
Visit the Rational Functional Tester area on developerWorks for introductory to in-depth
information.
Explore the Rational Functional Tester Information Center, where you can also take a short
video tour.
Investigate Rational Functional Tester Plus, which is a software application testing bundle.
Improve your skills. Check the Rational training and certification catalog, which includes many
types of courses on a wide range of topics. You can take some of them anywhere, any time,
and many of the Getting Started ones are free.
Read other articles written by Rekha Deshmukh.
Try Rational Functional Tester free requires registration).
Evaluate IBM software in the way that suits you best.
Run scripts through the Rational Functional Tester command line Page 6 of 6