Saturday, June 29, 2013

Introduction to IBM Rational Functional Tester (RFT)

IBM Rational Functional Tester is an automated functional testing and regression testing tool. This software provides automated testing capabilities for functional, regression, GUI, and data-driven testing. Rational Function Tester supports a range of applications, such as web-based, .Net, Java, Siebel, SAP, terminal emulator-based applications, PowerBuilder, Ajax, Adobe Flex, Dojo Toolkit, GEF, Adobe PDF documents, zSeries, iSeries, and pSeries.

Benefits of using Rational Functional Tester

·         Automated testing: Enables testers to automate tests resilient to frequent application user interface changes with ScriptAssure technology
·         Storyboard testing: Simplifies test visualization and editing using natural language and rendered screenshots.
·         Data-driven testing: Lets you perform the same series of test actions with a varying set of test data.
·         Test scripting: Combines a recorder of user actions with multiple customization options and intelligent script maintenance capabilities.
·         Integration: Integrates with IBM Rational Team Concert and IBM Rational Quality Manager to provide access to work items and logical or compound SCM test asset support.
·         Framework  creations : Rich set of APIs to create test automation frameworks


·         Rational Functional Tester version 8.2 and above
·         Basic knowledge of  Rational Functional Tester

Object Maps in IBM Rational Functional Tester (RFT)

The information about the GUI objects that RFT interacted during recording is stored as a test asset of the script. This test asset is called Object Map. Object Map represents the static hierarchical information of the objects in the Software Under Test (SUT) that are interacted during recording. The hierarchical information represents the object model in the SUT. For each test object in the object map we can traverse to the parent till the top level window. The hierarchy is very strict and it doesn't contain the cyclic dependencies and no indirect associations. The object maps maintain a set of recognition properties that describes each of the objects. The hierarchical information and the recognition properties are used by RFT to locate the GUI object during the execution of a recorded script.

One of the mot important strength of object map is that the information about the control is externalized from the test script to object map and the script refers to the object in the object map. This way, if the objects in the application changes, then  all the script that refers the object need not to be changed, rather the changes can be made to the object in the object map.  This means the user just need to update the objects in the object map without the need to modify all the scripts that refers to the objects

Types of relationships in Object Map

Every test object in the object adhere to either of the tow relationships
·         Parent/Child – container ship relationship (for GUI Test Objects this means the parent includes the coordinate space of the child).
·         Owner/Owned – non-contained relationship (such as a dialog to the parent window).
The above relationship information in the object maps helps RFT to find out the correct object during playback of the script

Types of Object Maps

There are two types of Object Maps supported by RFT: Shared Object Map and Private Object Map.

Shared Object Map can be associated with multiple scripts, means many scripts shares the same object maps.

Benefits of Shared Object Map
·         Reduces script/map maintenance (fix once and every associated script gets it)
·         Best for more sophisticated users running in a contained environment.
·         Managed independent of any single script

 Figure 1 : Creating a Shared Object Map

Private object maps can be only associated with one script, it’s private to that script

Benefits of Private Object Map
·         Simplest usage model
·         Map maintenance is by script and not shared.
·         Best for novice users or users running in a fragmented or dispersed environment

Figure 2 : Private Test Object Map in Script Explorer








Figure 3: A Test Object showing the hierarchical and recognition properties of test object

Every test object in the Test Objects section of the Script Explorer refers to an object in the Object Map

Figure 4: Relationship between test object name in the script and objects in test object map

The test objects in the Test Objects section of the Script Explorer view are stored in a file called script definition file (.rftdef) for each script. The script definition file can be located under the resource folder of the RFT project.  The test object  refers the object in the object map via this script definition file using the object map id of the object in the test object. This way the test object name in the Script Explorer can be renamed without affecting the object that refers in the object map.

 Figure 5 : Relationship between script definition and test object map

Recognition Properties

Recognition properties of each object in the object map are the properties that RFT collects during the recording and persist and then uses these properties during script execution to find the unique object. Every recognition property will have a weight assigned to it. The weight can vary from 0-100. Lower weight means that property is less significant and the high weight means most significant. RFT assigns default weight for each of the recognition properties and your can modify the weight if required.

Figure 6 : Recognition Properties of a Test Object

Administrative Properties

Administrative properties are those properties of the test object in test object map that are not used for recognition of the object during execution , rather gives information such as Domain , Role, Proxy and Test Object class name used for the control that are interacted during recording. It is advised to not to change administrative properties, especially properties such as Map ID. Some of these properties such as Role, Test Domain can be used in the find() API.

Figure 7 : Administrative Properties of a Test Object

Changing the default recognition properties

Recognition properties for each control type are pre-configured by RFT. If you need to modify the pre-configured recognition properties for each type of the control, then it can be done by using the Object Properties Configuration Tool This wizard can be brought up from Configure->Configure Object Recognition Properties… menu option from RFT.  These changes are global and the changes will be reflected for all instance of the object that is interacted during recording.

 Figure 8 : Changing the pre-configured recognition properties of a test object

If the recognition properties are changed, the original properties can be restored using the Restore button in the object properties configuration tool. The changes in the recognition properties will be in effect when you start the recording or when you update the test object. The recognition properties can be exported and then can be imported from RFT on one machine to other.

Updating the recognition properties of already recorded object

Recognition properties of an object in the object map can be updated using the Update Recognition Properties… Wizard.  For updating the recognition properties using this wizard, the application should be available with the control visible in the application.

Figure 9 : Updating the recognition properties of a test object

The Update Recognition Properties shows the current, original and all active properties of the control. User can select the properties from the active properties list and double click on the property to add to the recognition properties list.  The example below shows adding an additional property called .tag to the recognition properties set. Note that this will only update the recognition properties of a particular object in the object map, that way the changes are local to the object in the object map.

 Figure 10 : Selecting new properties to update the properties of a test object

Inserting an object to Object Map

You can insert a new object to an Object Map using Insert Objects… option available in the Object Map. This will bring up the test object insertion wizard. 

Figure 11 : Inserting new test objects into the test object map

 Using this wizard customer can select the object that the user wanted to add to the object  map

Figure 12 : Wizard to select an object from application to insert into test object map

Converting the recognition values to Regular Expression

One of the reason for failing to find the object using the recognition properties it that the properties keeps changing from one instance of to another instance of the application or from one build to another build of the application. An example is that the title of the page you visited during the recording. The title of the page can change from one build to another build of the application. Converting the varying part of the property value to a regular expression to minimize the script failure issues.

 Figure 13 : Converting property value to regular expression 

To covert the property to regular expression, right click on the property and select Convert Value to Regular Expression as shown in the figure above. After the above option is selected you can now select the part of the property value to be converted and then right click and selected the appropriate regular expression as shown in the figure below.

Figure 14 : Selecting appropriate regular expression for property value

After the value is converted to a regular expression you can evaluate the regular expression by selecting the Evaluate Regular Expression option.

Figure 15 : Regular expression evaluator

This way you can find out the properties that are changing in your application and can covert them to appropriate regular expression to minimize the playback failures due to dynamic recognition properties.

Dynamic Test Objects in Object Map

The hierarchy of a test object in the object map represents the order of search of the particular control during playback. Over a series of application changes, the hierarchy of the objects may change if new objects are introduced in the test application. This results in a playback failure. Using dynamic test objects you can anchor a test object as a descendant to its parent. To insert a Dynamic Test Object you can perform the following steps

  1. In the Test Object Map toolbar, click Test Object > Insert Dynamic Test Object Functional Tester opens the Object Map dialog box.
  2. On the Select an Object page, click the Object Finder icon and drag it into the application over the object you want to add to the test object map.
  3. Click Next.
  4. In the Add Dynamic Test Object dialog box, select Anchor to Selected Parent. By selecting Anchor to Selected Parent, you are making the new object a descendant of its parent. You can now search for the object dynamically, anchoring to the parent. You can edit the recognition properties by double clicking on the object properties.
  5. Select the object that you want to insert and click Finish.
To convert an existing mapped object to a dynamic object, right-click in the test object map and click Convert To Dynamic Test Object

Figure 16 : Converting a test object to dynamic test object

In the Convert To Dynamic Test Object wizard select one of the parent as the anchor

Figure 17 : Selecting a parent to anchor for dynamic test object

Once the parent is selected as an anchor, the object moves directly below the anchor in the object map. During execution of the script, the object will be searched at descendant level to find the object.

 Figure 18 : New hierarchy for the dynamic test object

Unifying the objects in the Object Map

Over the time as application undergo changes there might be two different test objects in the Object Map for the same control in the application.  You can unify these two objects in the object map into one by using the unify option available in the object map. 

 Figure 19 : Unifying two test object

After the source object to unify is selected, you need to select the Target object to Unify and the Unify Test Objects wizard can be used to select the properties from source or target to created the unified test object properties.

Figure 20 : Select the properties from source and target to merge properties

Finding and modifying the values of object in the Object Map

The test object map editor provides easy way to find the object information quickly using the find options. The Find & Modify option can be used to find the object information based on property or value and can modify the values

Figure 21 : Find and Modify test object map attributes