Use the API to edit functional test scripts
These topics describe how you can take advantage of the Functional Tester application programming interface (API) to make changes to functional test scripts. As a general rule, your modifications should emulate as closely as possible the desired user interaction with the application-under-test.
You can start by making some of these simple modifications to recorded functional test scripts:
- Change a user action, such as object().drag() to object().click().
- Delete recorded commands.
- Place an often repeated sequence of actions into a method.
- 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.
- Modifying options for script execution
Some options that affect script execution can be specified through the user interface. Values set in the user interface persist as the defaults from script to script. You can, however, also set some of these options directly in the Functional Tester script, for example, the amount of time between keystrokes.
- Start a Functional Tester script from within a script
Functional Tester scripts can contain methods that invoke other test scripts. You might want to take advantage of this functionality by creating a Functional Tester script that serves as a command file for a suite of scripts.
- Querying values of object properties
Components in the application-under-test, such as dialog boxes, command buttons, and labels, have associated pieces of information called properties. Properties have a name and a value. This topic provides examples of why you may want to modify your script to access an object property.
- Unregistering references to test objects
Helper script methods refer to an object in the application-under-test by using the test object map. Functional Tester finds such mapped objects each time a method is called on the object. In some cases; however, you might not want Functional Tester to do this.
- Handling ambiguous recognition
In some situations during playback, Functional Tester might not be able to differentiate between two like objects in the software under test. This topic describes handling these situations.
- Add manual and dynamic verification points
In addition to verification points specified during recording, you can also incorporate new verification points into a Functional Tester script. Scripting manual and dynamic verification points enables you to specify data for comparison against an object that is not found in the test object map. The data, however, must be value-class based.
- Handling unexpected active Windows
A common problem in GUI testing is the appearance of an unexpected active window -- for example, a warning message box in an HTML browser. This topic describes how to handle this problem.
- Functional Tester examples
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 Functional Tester.
- Determining the values of cells in a table
When working with Java or HTML tables, you might want to extract the value of a given cell in the table. There are many ways to do this; one simple approach is to query the table directly.
- Reading the Windows registry with Functional Tester
The Windows registry is a database used by the Windows operating system to store configuration information. Often it becomes necessary for a tester to read information out of this database using Functional Tester commands. This topic provides examples for doing this.
- Iterating through items in a tree control using the getTestData method
This topic provides an example of using Functional Tester's getTestData method to programmatically access the values on the branches of a tree control.
- Iterating through table cells using the getTestData method
This topic provides an example of using Functional Tester's getTestData method to access the values in the cells of a grid control.
- Passing parameters to the callScript method
This topic describes how to use the different signatures of the callScript method to pass data from one script to another.
- Extracting data from a combobox/list control (JComboBox)
You can use Functional Tester's getTestData method to access the values in the list of a ComboBox/List control.
- Playing back low level mouse and keyboard actions
Low-level playback of mouse and keyboard actions provides more control of events of user actions. For example, Functional Tester currently supports TestObject.click(), where the click consists of low-level actions including mouse move, left mouse button down, and left mouse button up. With this functionality, you can play back the individual components of a mouse click.
- Searching for test objects
Rational Functional Tester supports a means for locating one or more TestObjects matching specified search criteria. The search is based on name/value pairs representing properties of the TestObject or TestObjects you are looking for. The search can either be global, or limited to children of a parent TestObject.
- Searching for SAP TestObjects
Functional Tester supports a means for locating one or more SAP TestObjects matching a specified search criteria, even without using the Object Map.
- Tracing AJAX requests
You can test AJAX-based applications in two different ways; by setting the Auto Trace option to true or by setting the Auto Trace option to false on the corresponding document object. By setting Auto Trace option to true, you can trace the AJAX requests.
- Searching for GEF objects
Functional Tester recognizes the GEF EditParts and Palettes. Some Figures may not have an association with an EditPart. You can use Functional Tester APIs to find such Figures as shown in the below examples.
- Passing parameters by using the describe function in PowerBuilder
In PowerBuilder, you can use the describe() function to identify the properties of DataWindow objects and their controls. The describe() function is available only with the PowerBuilder DataWindow. The describe() function returns a string as a result of the parameters that are specified as a part of the describe() function. For example, you can find the data types of the column in a table style presentation. You can use the describe function in IBM Rational Functional Tester as shown in the following examples.