Introduction
Rational Functional Tester is an object-oriented automated testing tool that tests Windows, .Net, Java, HTML, Siebel and SAP applications, and lets you record reliable and robust scripts that can be played back to validate new builds of a test application.
The object-oriented recording technology in Functional Tester lets you generate scripts quickly by recording applications against the application-under-test. The recorded events are captured in the form of java code which is played back during testing.
Advantages in using RFT
Accuracy in functional testing.
Efficiency in the Regression testing.
Less time in setting up tests
Quicker execution.
Mapping of System Test Cases and Requirement Traceability Matrix.
Test accuracy is more and chances of human error are less.
Very less human effort is required (Creation of test code).
To record a script:
You can first set any recording options you may need. Click Window > Preferences to access the Functional Tester options.
Click the Record a Functional Test Script button or click File > New > Functional Test Script Using Recorder. The Record a Functional Test Script dialog box opens.
In the Record a Functional Test Script dialog box, select the project you want the script to be part of. Type a name for the script. (Note: Script names cannot contain space or any of the following characters: $ \ / : & * ? ” | # % -)
Click the Display Help icon on the Recording toolbar in the monitor for information on the toolbar buttons and how the monitor works.
On the Recording toolbar, click the Start Application button to start your test application.
Perform any actions in the application.
If you want to record a verification point, locate the object in your application you want to test, and click anywhere in the application window or dialog box. Next, click the Insert Verification Point or Action Command button.
If you want to insert any features into the script, such as a call script command, log entry, timer, script delay command, or comment, click the Insert Script Support Commands button.
Close your application, if you want closing the application to be part of the script.
When you are finished recording, click the Stop Recording button.
Recording in an existing script
With Functional Tester, you can start recording at the cursor location in the current script, which enables you to start applications, insert verification points, and add script support functions.
To start recording in an existing Functional Tester script:
Place the cursor in the script where you want to begin recording.
Start recording in either of these ways:
In the Functional Tester menu, click Script > Insert Recording.
In the Functional Tester toolbar, click the Insert Recording into Active Functional Test Script button .
Functional Tester opens the Recording Monitor and starts recording.
To start your test application, on the Recording toolbar click the Start Application button .
Perform any actions in the application.
To record a verification point, locate the object in your application you want to test and click the Insert Verification Point or Action Command button.
To insert any features, such as a call script command, log entry, timer, script delay command, or comment into the script, click the Insert Script Support Commands button.
Close your application, if you want closing the application to be part of the script.
When you are finished recording, click the Stop Recording button.
To run a script from Functional Tester:
Run the script in any of the following ways:
In the Functional Tester Projects view, click a script and click Run Functional Tester Script in the Functional Tester toolbar.
In the Functional Tester Projects view, right-click a script and click Run.
In the Functional Tester Projects view, click a script and then click Script > Run.
The Script Launch Wizard appears.
Optionally, if you want to prevent the Script Launch Wizard from displaying when you run a test script, do the following:
In Functional Tester, Java Scripting, click Windows >Preferences or in Functional Tester, click Tools > Options.
Click Functional Tester > Playback > Logging.
On the Logging options page, click the Don’t show script launch wizard check box.
On the Select Log page, keep the default log name or select a log name.
Optionally, you can enter run arguments or set a “Datapool” iteration count:
Click Next to display the Specify Playback Options page.
In the Run arguments field, enter or select command-line arguments to pass to the script if required.
In the “Datapool” Iteration Count field, select a number or Iterate Until Done to specify how many times a test script runs when you run the test script.
Click Finish to begin running a test script.
Recording and playing back double byte characters on Chinese systems
The following information pertains to record and playback of DBCS on Chinese systems.
Simplified Chinese:
The only Input Method Editor (IME) that is supported for recording and playing back scripts using Functional Tester on Simplified Chinese systems is the MS-PinYin IME. During script playback this IME will automatically be activated for the input of Chinese characters, provided the IME is present on your system. Use of other IMEs for recording is not supported and may yield unexpected results.
Traditional Chinese:
Two IMEs are supported for the recording and playback of Traditional Chinese characters: the New Phonetic and New ChangJie IMEs. During script playback the New Phonetic IME will automatically be activated for input of Chinese characters and if that is not present, the New ChangJie IME will be used. Use of other IMEs for recording is not supported and may yield unexpected results.
Writing messages to the log
A log is a file that contains the record of events that occur while a Functional Tester script is playing back. There are several different methods you can use to write messages to the log.
Functional Tester supports several types of log files, or no logging at all. You select the type of log file (TestManager Log, HTML Log, or Text Log) through the user interface. Each logged event has an associated message. In a TestManager log, you can see this message by right-clicking the event in the log and selecting Properties.
Functional Tester automatically logs the following events:
Script start
Script end
Calls to the callScript method
Calls to the startApplicaction method
Timer start
Timer end
Exceptions
Verification points
Data-driving tests overview
When you data-drive a test, the script uses variables for key application input fields and programs instead of literal values so that you can use external data to drive the application you are testing.
Data-driven testing uses data from an external file, a datapool, as input to a test. A datapool is a collection of related data records which supplies data values to the variables in a test script during test script playback.
Because data is separated from the test script, you can:
Modify test data without affecting the test script
Add new test cases by modifying the data, not the test script
Share the test data with many test scripts
Regular expressions
You can replace a recognition property with a regular expression or a numeric range to allow for a pattern-based recognition. The pattern allows for more flexibility in the object recognition. You can convert properties to regular expressions and numeric ranges from within the Verification Point Editor or the object map.
Using API in functional test scripts
All the objects of the application under test, used during recording are mapped in the test object map. How to pick up an object at runtime?
Reading various properties of an object at runtime.
Using the Test Object Inspector.
Creating your own log file.
Calling an another script from within a script.
Calling a script with arguments.
Calling a script with datapool options [e.g. callScript(“script_name", DEFAULT_ARGS, DP_ALL);]
Reading data from a Html table.
Iterating through the datapool with test script.
Using Regular expressions to avoid recognition error.( This is needed as the tool captures the full URL of any object while recording. In case playing back the script has to be done on a different environment the script starts failing.)