Rational® Functional Tester examples

Rational® Functional Tester ships with some example code you can use in your own scripts. You can open these examples from within the sample project shipped with Rational® Functional Tester.

To access the sample project, open the Samples Gallery from the Welcome Page, or from the Help menu. Click Help > Samples Gallery. In the gallery, browse to the Rational Functional Tester Sample Project, which is listed in the Technology category.

Rational® Functional Tester sample project

The sample project was created using the Rational® Functional Tester tutorial. You can look at the script and other test assets while you do the tutorial, or after you complete it, if you want to compare them to your files.

The sample project contains the script, verification points, object map, and other files that are created when you complete the tutorial. The sample script is in the state it would be in at the end of the tutorial. For reference, you can look at the script or other assets to compare them with your own, or actually play back the script. The tutorial script is called "ClassicsSample."

To open the project, click the Import link. The project will then be displayed in the Projects View. Click the script name to see it in the script window. You can play back the script by clicking the Run Functional Test Script button Run Functional Test Script on the product toolbar

In addition, the project has some example code you can use in your own scripts.

Examples

Class Package Description
ExtensionScript superscript Provides some general utility methods.
HtmlScript superscript Provides handler to automatically dismiss unexpected active HTML Dialogs.
WindowScript superscript Provides some methods that may be useful for getting around problems with native Microsoft® Windows® Applications.
SwtScript superscript Provides some methods that may be useful when testing SWT-based applications. Note that this implementation makes use of WindowScript, which is Microsoft-Windows specific. This class will not work on Linux®.
EclipseScript superscript Provides some methods that may be useful when testing plugins running inside the Eclipse platform (see http://www.eclipse.org/). Note that this code makes use of internal Eclipse classes, and consequently may break with future versions of eclipse. This class illustrates invoking static methods in the SUT and using custom Test Objects.
WorkbenchTestObject testobject.eclipse A Test Object for the Eclipse (see http://www.eclipse.org/) shell Workbench.
WorkbenchWindowTestObject testobject.eclipse A Test Object for the Eclipse (see http://www.eclipse.org/) shell WorkbenchWindow.
WorkbenchPageTestObject testobject.eclipse A Test Object for the Eclipse (see http://www.eclipse.org/) shell WorkbenchPage.

Using the examples

If you would like to use these examples, copy the testobject and superscript directories and their contents into a Functional Test project.

To use one of the superscripts, set the helper superclass property for a script to the full class name of the superscript. For example, to use the ExtensionScript superclass, for a script called X, right-click X in the Functional Test Projects View and select Properties from the popup menu. In the dialog titled "Properties for X.java", select "Functional Test Script" in the list on the left. Finally, set the text in the edit box labeled "Helper superclass" to "superscript.ExtensionScript". You can also modify your project preferences so that all newly created scripts in the project will extend this superscript. To define a default helper superscript for a project, right-click the project and select Properties from the popup menu, then set the text field in "Rational® Functional Tester Project" labeled "New Script Helper superclass".

Once this is done, your X.java script can make use of the additional methods of ExtensionScript such as getClipboardText(), setClipboardText(), clipboardVP(), etc.