RFT Tutorial

22
1: How to retrieve the value of an object property programmatically? In the following example we use the getProperty method to find out as to whether a label contains a success message. If it contains the success message, the OK button will get clicked. If it doesn't contains the success message, the Cancel button will get clicked. if("SUCCESS".equals(dialog_htmlDialogStatic(). getProperty(".text"))) { dialog_htmlDialogButtonOK().click(); } else { dialog_htmlDialogButtonCancel().click(); } Tutorial - 2: How do we use an anchor to locate a particular object using RFT? This short tutorial describes a method of using an anchor to locate a particular object in RFT. Use of an anchor is useful in pin pointing a test object, which normally RFT finds it difficult to differentiate between two similar objects during playback. This happens usually when two browsers or instances of the same application are open simultaneously. We can identify the browser and the instances of the application by using a TestObject reference. Running more than one instance of an application simultaneously during playback will result in ambiguity about the target of commands like object() or click(). To solve this problem, we can use "ProcessTestObject" when we call the "startApp" command as described below. ProcessTestObject pto1 = startApp("ApplicationOne"); ProcessTestObject pto2 = startApp("ApplicationTwo"); object(pto1, DEFAULT).click(); In the above example, the "ProcessTestObject" functions as an anchor to locate the desired application. Tutorial - 3: What steps are needed to be performed for setting up the RFT?

description

RFT

Transcript of RFT Tutorial

Page 1: RFT Tutorial

1: How to retrieve the value of an object property programmatically?

In the following example we use the getProperty method to find out as to whether a label contains a

success message. If it contains the success message, the OK button will get clicked. If it doesn't contains the success message, the Cancel button will get clicked.

if("SUCCESS".equals(dialog_htmlDialogStatic().

getProperty(".text")))

{

dialog_htmlDialogButtonOK().click();

}

else

{

dialog_htmlDialogButtonCancel().click();

}

Tutorial - 2: How do we use an anchor to locate a particular object using RFT?

This short tutorial describes a method of using an anchor to locate a particular object in

RFT.

Use of an anchor is useful in pin pointing a test object, which normally RFT finds it difficult to differentiate between two similar objects during playback.

This happens usually when two browsers or instances of the same application are open

simultaneously. We can identify the browser and the instances of the application by using a

TestObject reference.

Running more than one instance of an application simultaneously during playback will result in ambiguity about the target of commands like object() or click().

To solve this problem, we can use "ProcessTestObject" when we call the "startApp" command as described below.

ProcessTestObject pto1 = startApp("ApplicationOne");

ProcessTestObject pto2 = startApp("ApplicationTwo");

object(pto1, DEFAULT).click();

In the above example, the "ProcessTestObject" functions as an anchor to locate the desired application.

Tutorial - 3: What steps are needed to be performed for setting up the RFT?

Page 2: RFT Tutorial

This short tutorial describes various steps required for setting up the RFT.

Use the Java Runtime Environment (JRE) which gets installed while loading RFT and gets enabled for

testing Java applications.

Before starting recording of any script following steps are essential:

Step - 1: Setting up the logging options. RFT provides many logging options. Here we can use the HTML log.

a) To verify that HTML logging is set, click "Window" > "Preferences".

b) In the left pane of the Preferences window, expand "Functional Test" > then "Playback" > click "Logging".

c) Verify that the Use "Default" check box is selected and that html appears in the "Log type" field.

d) Click "OK".

These setting of Step -1, shall open the HTML log automatically after playing back of a script.

Step - 2: Creation of a Functional Tester project

a) In the Functional Tester menu, click "File" > "New" > "Functional Test Project".

b) Provide a logical "Project name" without any spaces for example - Testtutorial.

c) Provide a logical "Project location" for example - C:\Testproject. This will create a new folder.

d) If the source control option is available, do not select "Add the project to Source Control".

e) If the associate project option is available, do not select "Associate the Functional Test Project with current Rational Project".

f) Click "Finish".

The Testtutorial project is now visible in the Functional Test Projects view, which is the left pane in the RFT perspective.

Tutorial - 4: How do we record a script using Rational Functional Tester - RFT?

This tutorial describes a method of recording a script in Rational Functional Tester – RFT

from IBM.

Step - 1: Setting of the recording options.

Click "Window" > "Preferences" to access the RFT options. In the tree hierarchy, click the plus sign

(+) on the side of "Functional Tester " to expand the preferences. Define the desired recording

options. Close the preferences after completion.

Step - 2: 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.

Page 3: RFT Tutorial

Step - 3: In the "Record a Functional Test Script" dialog box, select the project to which the new

script shall be associated. Provide a name for the new script. The script name should not contain space or special characters like : $ \ / : & * ? " < > | # % -

Step - 4: In case it is required to keep the script under source control, Check mark "Add the script to

Source Control". This will add the script to "ClearCase", however the script shall remain checked out

and we are able to make changes in it.

Step - 5:

a) Click "Finish" to open the Recording Monitor & start the recording.

RFT will create a local object map for our script by default.

b) Click "Next" to open the "Select Script Assets page", In case we wish to use a different test object map, helper superclass, or test datapool.

c) From the "Select Script Assets page", we can define the datapool record selection order and we can also change the datapool associated with the script.

Step - 6: Upon opening of the Recording Monitor and starting of the recording after Step -5, Click the

"Display Help" icon for getting information on the toolbar buttons and regarding operation of the

monitor.

Step - 7: Click the "Start Application" button on the "Recording" toolbar to start the test application. Perform the desired actions on the running application.

Step - 8: a) For recording a verification point, identify the object in the application.

b) Click anywhere in the application window or the dialog box.

c) Click the "Insert Verification Point or Action Command" button.

Step - 9: Click the "Insert Script Support Commands" button for inserting any special features into

the script. Features can be a call script command, log entry, timer, script delay command, or comment etc.

Step - 10: Close the application, if we want closing of the application to be part of the script.

Step - 11: Click the "Stop Recording" button to finish the recording.

This process writes the script and object map into the project directory. RFT window gets restored and

the recorded script gets displayed.

Tutorial - 5: How do we record data verification point for test objects using RFT?

This short tutorial describes a method of recording a data verification points for test objects using RFT.

The purpose of creating verification points is to verify that a particular desired action has taken place, or to verify the state of an object.

Page 4: RFT Tutorial

Step - 1: Start the Recording:

a) In RFT Java Scripting, click the "Record a Functional Tester Script" button on the Functional Tester

toolbar or the "File" > "New" > "Functional Tester Script Using Recorder" menu command to start recording a script.

b) In RFT VB.NET Scripting, click the "Record a Functional Tester Script" button on the Functional

Tester toolbar or the "File" > "New" > "Add Script Using Recorder" menu command to start recording a script.

Step - 2: Start the test application by clicking the "Start Application" button in the RFT Recording

Monitor.

Step - 3: Locate the list in the application which is intended to be tested.

Step - 4: In the RFT Recording Monitor, click the "Insert Verification Point or Action Command"

button on the toolbar.

Step - 5: On the "Select an Object" page of the Verification Point and Action Wizard, use the Object

Finder to select the list in the application intended to be tested. To test the entire list, we can select any item in the list.

Step - 6: After selecting the list, we can see that one of the values shown on the Object recognition properties grid is "list." Verify this "List" and click Next.

Step - 7: Go to the "Select an Action" page. Select the first option on the page i.e. "Perform Data

Verification Point" option.

Step - 8: In the "Data Value" field, select either of the following:

a) "List Elements" - to test the contents of the entire list. or

b) "Selected List Elements" test - to test only the items which are selected.

Step - 9: In the "Verification Point Name" field, accept the default suggestion, or provide a new name

of own choice.

Step - 10: Use the "Include Retry Parameters" to set a retry time for a verification point during

playback to check for its existence. This retry option shall be helpful to us when playback will fail to find the verification point in the application.

Step - 11: After accepting or editing the above fields, click "Next" to continue.

Step - 12: After viewing or editing the list data, click "Finish" button. This will record the verification point & it will be added to the script.

Step - 13: Finish the recording by clicking the "Stop Recording" button on the "Recording Monitor"

toolbar.

We can open the Verification Point Editor any time to edit the data recorded earlier.

Tutorial - 5: How do we record data verification point for test objects using RFT?

Page 5: RFT Tutorial

This short tutorial describes a method of recording a data verification points for test

objects using RFT.

The purpose of creating verification points is to verify that a particular desired action has taken place, or to verify the state of an object.

Step - 1: Start the Recording:

a) In RFT Java Scripting, click the "Record a Functional Tester Script" button on the Functional Tester

toolbar or the "File" > "New" > "Functional Tester Script Using Recorder" menu command to start recording a script.

b) In RFT VB.NET Scripting, click the "Record a Functional Tester Script" button on the Functional

Tester toolbar or the "File" > "New" > "Add Script Using Recorder" menu command to start recording

a script.

Step - 2: Start the test application by clicking the "Start Application" button in the RFT Recording Monitor.

Step - 3: Locate the list in the application which is intended to be tested.

Step - 4: In the RFT Recording Monitor, click the "Insert Verification Point or Action Command" button on the toolbar.

Step - 5: On the "Select an Object" page of the Verification Point and Action Wizard, use the Object

Finder to select the list in the application intended to be tested. To test the entire list, we can select

any item in the list.

Step - 6: After selecting the list, we can see that one of the values shown on the Object recognition properties grid is "list." Verify this "List" and click Next.

Step - 7: Go to the "Select an Action" page. Select the first option on the page i.e. "Perform Data Verification Point" option.

Step - 8: In the "Data Value" field, select either of the following:

a) "List Elements" - to test the contents of the entire list. or

b) "Selected List Elements" test - to test only the items which are selected.

Step - 9: In the "Verification Point Name" field, accept the default suggestion, or provide a new name of own choice.

Step - 10: Use the "Include Retry Parameters" to set a retry time for a verification point during

playback to check for its existence. This retry option shall be helpful to us when playback will fail to

find the verification point in the application.

Step - 11: After accepting or editing the above fields, click "Next" to continue.

Step - 12: After viewing or editing the list data, click "Finish" button. This will record the verification point & it will be added to the script.

Page 6: RFT Tutorial

Step - 13: Finish the recording by clicking the "Stop Recording" button on the "Recording Monitor" toolbar.

We can open the Verification Point Editor any time to edit the data recorded earlier.

Tutorial - 6: How can we create a new RFT script Manually i.e. without Recording?

There is an alternative to recording, wherein we can manually create a script to enter the Java code

for use in RFT.

When we create a new script, the RFT includes import statements for all the files required to compile

the script and comments. These files contain important archiving information. By default, RFT uses

the script name as the class name and sets up testMain, where we can add various commands to include in the script.

This short tutorial describes various steps to create a new RFT script manually as a substitute for recording:

Step –1: Click the "Create an Empty Functional Tester Script" button on the RFT toolbar

Alternatively

Click "File" > "New" > "Empty Functional Tester Script" on the RFT menu.

Step –2: In the "Create an empty Functional Tester script dialog box", enter or select a folder

for the script and type a name in the "Script name" field.

The script name must follow the naming conventions defined for Java class names.

Step –3: Apply the check mark against "Add the script to Source Control" in case we want to keep the script under source control.

Step –4: Here we have two options to create a local test object map for the script:

Option –1: Click "Next" for using a different "Test Object Map", "Helper Superclass", or "Test

Datapool".

Chose the desired test assets out the following choices offered in the "Select Script Assets page", and click "Finish":

# Select and set a default test object map.

# Select and set a default helper Superclass.

# Select a test Datapool.

# Select a Datapool record selection order.

Option –2: Click "Finish" for creating a new script.

This step creates a local test object map for our script and displays the script in the Projects View.

Page 7: RFT Tutorial

Step –5: To put the script under source control:

1) Do Right-click over the new script in the Projects View

2) Click "Team"

3) Click "Check In".

4) Click "Finish" in the "Check In" dialog box.

Step –6: Start adding the desired code to the script.

For adding the desired objects and methods to the script we can use the Test Object Map.

We can add special features like call script command, log entry, timer, script delay, or comment to

the script. This can be done by clicking the "Insert Recording into Active Functional Tester

Script" button available on the toolbar of RFT. Then on the Recording toolbar, click the "Insert

Script Support Commands button".

We can also use the buttons on the Recording toolbar for starting an application from the script or for

creating a verification point.

Tutorial - 7: How to do recording in a RFT script which is already existing?

This short tutorial presents a simple method to do recording in an already existing RFT

script.

Invariably we come across a situation that we need to do additional recording in an already existing

script.

It is quite simple in RFT. The only thing we need to do is to bring the cursor at the desired location in

the existing script & start the recording from there onward. The process of such recording is no

different from the fresh recording. All features like starting the applications, inserting the verification points, and adding the script support functions are available as usual.

Following are the steps to begin recording in an existing RFT script:

Step – 1: Bring the cursor to a location in the existing script from where onwards we intend to start

the recording.

Step – 2: Next step is to open the "Recording Monitor" and starts the recording. This can be done in

either of the following two ways:

Method – 1: Click "Script" > "Insert Recording" from the In the RFT menu.

Method – 2: Click the "Insert Recording into Active Functional Test Script" button available In

the RFT toolbar.

Step – 3: Next step involves starting the test application. This can be done by clicking the "Start Application" button on the "Recording" toolbar.

Step – 4: Now we can perform all desired actions over the application.

Page 8: RFT Tutorial

Step – 5: We can record a verification point as well at this stage. This can be done by locating the

object in the application desired to be tested. A verification point can be inserted by clicking the "Insert Verification Point or Action Command" button.

Step – 6: We can insert any desired feature at this stage. The features like a call script command, log

entry, timer, script delay command, or comment into the script can be added by clicking the "Insert

Script Support Commands" button.

Step – 7: We can terminate the application, in case closing of the application is desired to be a part

of the script.

Step – 8: We can finish the recording operation by clicking the "Stop Recording" button.

This process restores the RFT window and displays the script

Tutorial - 8: How to use Verification Point Comparator Utility of RFT for comparing the Verification Point Data?

We use the "Verification Point Comparator" for comparing the verification point data after playing

back a script with a verification point and to update the baseline file.

In case the verification point happens to fail, the "Comparator" displays both types of values i.e. the

expected and actual ones, so that we can draw a comparison. This provides us adequate information for updating the baseline file with the actual values from the actual file.

The Comparator can be opened by either of the following methods:

1) Double-clicking the verification point in the RFT log in the "TestManager".

2) Clicking the View Results link in the RFT HTML log.

The Title of the Verification point gets displayed in the "Comparator" banner.

This short tutorial presents a simple method of using Verification Point Comparator Utility of RFT for comparing the verification point data

Following are the steps to compare and update the verification point data using the Comparator:

Step – 1: Record a script in RFT and ensure that it must have at least one verification point.

Step – 2: Play back the script containing the verification point on a new build of the application under test.

Step – 3: View the log of the concerned playback after it gets finished.

Step – 4: Open the "Comparator" from the log & view the verification point by the following.

a) In case of use of the TestManager log: Double click the verification point in the "Event Type"

column. Expanding the Script Start command can enable us to see the verification point.

b) In case of use of the HTML log: Click the "View Results" link. At this stage we are likely to get

a Java plug-in error. Thus to avoid this error, ensure that the Java plug-in is properly configured.

The Verification Point Comparator opens to display that verification point.

Page 9: RFT Tutorial

Step – 5: We may encounter failure of verification points. The failed verification points can be handled by:

a) In case of failure of one verification point while using log in RFT – Java Scripting: Select

the log in the RFT Projects view. Then, right-click the log, and click "Failed Verification Points".

b) In case of failure of one verification point while using log in RFT – VB.NET Scripting: Select the log in the Solution Explorer, right-click the log, and click "Failed Verification Points"..

c) In case of failure of multiple verification points while using log: The wizard of Results for

Verification Points shall open. Click the desired failed verification point in the list and click "View

Results" or "Finish".

The Verification Point Comparator opens to display the concerned verification point. The Comparator

displays the expected and actual data values. The difference between the expected and actual data

values is that we performed the test with some expected values. However the actual values were

captured in the application during the playback.

For failed verification points, the differences are indicated in red.

Step – 6: Understanding of display structure for expected versus actual values:

a) For Properties, List, Table and data Text type verification points: The expected values are

displayed on the left and the actual values are displayed on the right:

b) For Menu Hierarchy Properties and Tree Hierarchy type verification points: The expected

and actual values are shown contiguously. The expected values of the differences are shown in Red, and the actual values of the differences are shown below them in Green.

Step – 7: View the two data files to draw a comparison of differences between the expected and

actual files. By close analysis of the differences in the Comparator, we can find out if they are

intentional changes to the application or are real defects.

For navigating through the differences, we can use the navigation buttons on the toolbar above the data display.

Step – 8: We may need to edit the baseline file to update the information for future playbacks. For

this we need to load the baseline file. Click "File" > "Baseline" or click the button "Load Baseline to Edit" available on the toolbar.

The baseline file replaces the expected file on the left side of the display.

Step – 9: Editing of items in the data:

a) For individual items in the data: We can edit them in the baseline (left) column of the display.

Click "Save", after completion.

b) For a Text type verification point: Click "Edit Text" to launch the text editor to make the

changes.

c) For all other verification point types: We can edit directly in the baseline data display.

Step – 10: Replacement of Baseline file:

Page 10: RFT Tutorial

a) For a properties verification point, updating of the baseline value is to be done in case difference is observed in the baseline value and the actual value for a particular property.

In the Verification Point Comparator, Right-click the property where the values are observed to be different, and click "Replace Baseline on Current Selection".

b) In case all the differences reflect intentional changes to the application under test, and we want to

update the baseline to reflect the changes, we need to use the "Replace Baseline with Actual Value" toolbar button to replace the entire baseline file.

c) In case we have made any individual changes to the baseline data file – without the use of

"Replace Baseline with Actual Value" command, click File > "Save" to save the changes.

Step – 11: We can come out of the "Verification Point Comparator" after finishing the comparing and

updating operation on the verification point data, click "File" > "Exit" to exit the Verification Point Comparator

Tutorial - 9: How to create a Properties Verification Point in RFT for testing the properties of an object?

Brief Introduction - How a Properties Verification Point operate:

The purpose of a Properties verification point is use in testing the properties of an object in our application.

When a verification point is recorded, a baseline of the object's properties gets created. Thereafter

every time the script is played back, the properties will be compared to confirm if any changes have

taken place, may be intentionally or even unintentionally.

With the help of Properties verification point we can identify the presence of potential defects in our application.

This short tutorial presents a simple method of creating a Properties Verification Point in RFT for testing the properties of an object

Steps to create a Properties Verification Point are as under:

Step – 1: Starting of the recording operation of script:

a) For RFT – Java Scripting: Click the "Record a Functional Tester Script" button on the RFT

toolbar or the "File" > "New" > "Functional Tester Script Using Recorder" menu command.

b) For RFT – VB.NET Scripting: Click the "Record a Functional Tester Script" button on the RFT

toolbar or the "File" > "New" > "Add Script Using Recorder" menu command.

Step – 2: In the RFT Recording Monitor, click the "Start Application" button to start the test

application.

Step – 3: Locate the object in the application, which we want to test.

Step – 4: In the Functional Tester Recording Monitor, click the "Insert Verification Point or Action

Command" button on the toolbar.

Page 11: RFT Tutorial

Step – 5: Picking up the object in the application:

The objects in our application can be picked up on the "Select an Object page" of the Verification

Point and Action wizard, by either of the following three selection methods.

Method 1: Object Finder Tool method: For selecting an object and all descendents of the object, select one object, or select an object and the immediate children of an object.

Method 2: Test Object Browser method: For browsing for the object that we want to select. The

browser displays a hierarchical tree of objects in our application. The top level shows any applications

we are running. Under each top level, RFT displays the object hierarchy within that application. It is a dynamic view of the currently available objects.

Method 3: Time Delayed method: For selecting pop-up objects, like menus. This method uses the

Object Finder tool, but enables us to set a delay, which gives us time to reach an object which

requires clicking on other objects first.

Step – 6: Advancement to the next page in the Verification Point and Action wizard:

On the Select an Object page, the check box "After selecting an object advance to next page" is

selected by default. This causes automatic advancement to the next page in the Verification Point and

Action wizard.

Alternatively If the check box "After selecting an object advance to next page" is deselected, we

need to manually click "Next" to move to the next page.

Step – 7: Selection of various options for properties verification point:

a) On the "Select an Action" page, click the "Perform Properties Verification Point" option, and

then click "Next".

b) Use either of the following four options like:

1) "Include Children" – In case we want to include the properties of the object's child objects (in

case it has child objects).

2) "None" – For testing the object only without children.

3) "Immediate" – For testing the object and any immediate children present at one level down)

4) "All" – For testing the object including all of its children down the entire hierarchy.

Step – 8: Providing a logical name to the Verification Point:

Under "Verification Point Name", accept the suggested default, or type a new name in the box.

The new name if any must be in accordance with standard Java naming conventions.

Step – 9: Selection of properties type: Choose whether to use standard property or Nonstandard

properties types.

Standard properties are available across platforms and browsers; whereas nonstandard properties can include platform-specific properties.

Step – 10: Setting of retry time for the verification point during the playback:

Page 12: RFT Tutorial

The retry option is helpful when playback does not find the verification point in the application & retry option checks the existence of the verification point.

a) We use the "Include Retry Parameters" for setting the retry time for the verification point

during playback. We can either use the default values, or set our own values for the "Maximum

Retry Time" & "Retry Interval".

Here by default RFT will check for the existence of the verification point in the application every 2

seconds, for up to 20 seconds.

b) The value set under "Maximum Retry Time" indicates the maximum number of seconds RFT will

retry for the verification point to appear in the application during playback.

c) The value set under "Retry Interval" indicates the number of seconds between times that RFT

will check for the verification point during the wait period.

d) Click "Finish", to write the retry for verification point into the script, which will take place on

future playbacks.

Step – 11: Editing the properties data: (Optional step)

We need not test each & every property of the test object every time. Hence it is better to just test

the specific set of properties we want while using a Properties verification point.

a) The test object's properties and their values are available for editing in a tree table format on the

"Verification Point Data" page.

b) Only those properties can be edited which happened to be tested. We can edit the properties in the "Property" column, and can edit the property values in the "Value" column.

c) Making a selection of object properties by check marking them for the test:

# By default, all properties appear with no checkmark meaning thereby they will not be tested.

# We need to apply the check mark against the selected properties desired to be tested.

# Check marked properties will be tested each time we play back a script with this verification point.

# We can select all properties in the list by clicking the "Check All" toolbar button above the grid.

# We can use the "Uncheck All" button to clear the selection of all the properties.

# To edit a value, double-click the tree table cell. That particular cell becomes editable. We can click

outside the cell, which causes the edit to take effect.

# In the case of the color property, we can edit the color value from the Color Chooser available to

us.

Step – 12: Using a Datapool reference in place of a literal value for a property verification point:

a) In the "Property" column, select a property, right-click, and then click "Convert Value to Datapool Reference". This will open The Datapool Reference Converter dialog box.

Page 13: RFT Tutorial

b) Type a new name for the Datapool variable or click the "Datapool Variable" arrow to select the variable that we want the verification point to reference in the Datapool

c) Optionally, place a check mark on the "Add value to new record in Datapool" check box to add

the value of the verification point to a new record row in the Datapool.

d) Click "OK".

Step – 13: Click "Finish" to complete the process of recording & adding the verification point to the

script. Stop the recording by clicking the "Stop Recording" button on the "Monitor" toolbar.

Tutorial - 11: How to Data Drive a Test Script using IBM - RFT?

This article presents a simple method of data driving IBM - RFT Test Script

Steps for data driving a script are as under:

Step – 1: Creation of a Project: Project is the first & foremost workbench required to store the test assets which are needed for testing any application.

Step – 2: Beginning of the test script recording: Involves two steps like:

a) Choice of Datapool record selection order: While playing back, the test script accesses various

records in the datapool either sequentially or randomly. Thus choice out of these two options is done from the "Datapool Record Selection Order" box from the Select Script Assets dialog box.

# Sequential order: Records are accessed by the test script in a sequential order as they appear in the Datapool.

# Random order: Every record gets accessed by the test script randomly once from the Datapool.

b) Finish the selections: Click "Finish" to minimize the Functional Tester window and launching the Recording Monitor.

Step – 3: Navigation across the application to a point desired to be data driven:

# Click "Start Application" on the Recording toolbar.

# Now do necessary actions across the application as desired to be recorded in the test script.

Step – 4: Data Driving the test:

a) Opening of the Insert Data Driven Actions page after halting the recording of the test script. To do this; click "Insert Data Driven Commands" on the "Recording" toolbar,

b) Key in the initial values which are desired to be seen in the Datapool in the fields required to be

data driven in our application under test.

While recording is halted, we avoid recording of unwanted actions in the test script by populating such fields.

Step – 5: Selecting the test objects: Under "Populate then Select Test Objects" select the test

objects through either of the two methods:

Page 14: RFT Tutorial

Method –1: "Press and drag hand to select test objects" is used to select an object and all the

descendents of the selected object. This is the most common and direct method of selecting an

object.

Method –2: For opening the Select Object to Data Drive page, "Use selection wizard to select

test objects". To do this click on the "Drag Hand Selection" method with its options, alternatively click on the "Test Object Browser" method.

Step – 6: In case we had opted for method –1 under Step – 5 above i.e. "Press and drag hand to

select test objects"

a) Use the mouse to drag the hand shaped, "Object Finder tool", to the object in the application which is desired to be selected. RFT automatically outlines this object with a red border.

b) Now release the mouse button.

The Data Drive Actions page shall open now. The information about the objects selected by us appears under the DataDriven Commands table.

For viewing the line of the code inserted by RFT in our test script, we need to place the mouse pointer

over a row in this table for data-driving our application.

Step – 7: In case we had opted for method –2 under Step – 5 above i.e. "Use selection wizard to

select test objects", click on "Selection method" arrow for making a selection out of either of the further two methods:

Method –A: "Drag Hand Selection" method is used to include only the selected object, the

selected object and the immediate children of the selected object, or to include the selected object and all descendents of the selected object.

Method –B: "Test Object Browser" method is used to browse for the object desired to be selected.

Step – 8: In case we had opted for method –A under Step – 7 above i.e. "Drag Hand Selection"

method

a) Select or clear the option "After selecting an object advance to the next page".

b) Use the mouse to drag the hand shaped Object Finder tool, to the object desired to be selected in

the application. RFT automatically outlines this object with a red border.

c) Release the mouse button.

d) Click on "Next" if we opt for not selecting the option "After selecting an object advance to

next page".

e) Click on one of the following options:

# "Just the selected object"

# "Include the immediate children of the selected object"

# "Include all descendents of the selected object"

Step – 9: In case we had opted for method –B under Step – 7 above i.e. "Test Object Browser"

method

Page 15: RFT Tutorial

a) Browse the object tree to find the object required to be data-driven.

b) Click on the part of the tree required to be selected. Then Click "Next".

c) Click on one of the following options.

# "Just the selected object"

# "Include the immediate children of the selected object"

# "Include all descendents of the selected object"

d) Click "Finish".

The Insert Data Driven Actions page opens & presents all the information filled in under "Data

Driven Commands" and "Selected Command Description".

Step – 10: Click "OK" to finish the data-driving process for the script. This closes the "Insert Data

Driven Actions" page and RFT presents a Datapool containing all the data gathered from the

application.

Step – 11: Perform all other actions in the application, which we want to record. The actions can be

like: Recording a verification point or inserting desired script support functions into the script such as such as a call script command, log entry, timer, script delay command, or comment etc.

Step – 12: Close the application, if we want closing of the application to be part of the script.

Step – 13: Click on "Stop Recording" on the "Recording" toolbar, to append all the recorded

Information to the test script and update the Datapool with new variables and associated initial

values.

RFT window opens and the recorded script gets displayed in the editor window.

Tutorial - 12 : How to Create a Datapool using IBM – Rational Functional Tester - RFT

This article presents a simple method of creating a Datapool using IBM - RFT

Brief Introduction to Datapools:

A datapool is a test dataset, a collection of related data records which supplies realistic data values to

the variables in a test script during test script playback. We can create data from scratch or import

existing data into a new datapool from another RFT datapool, an IBM Rational TestManager datapool, or a .csv file.

Rules for working with datapools:

1) When we import data, we ensure that we import the data into the same RFT project as the test

scripts that access the data.

2) If we want to import data from a TestManager datapool, we need to first associate a RFT project with a Rational project to use the TestManager datapool.

Page 16: RFT Tutorial

Steps for Creating a Datapool are as under:

Step - 1: Click "Create a Test Datapool".

Step - 2: Applicable for RFT - Java Scripting:

2a) Either type the path to the folder we want or use the navigation tools ("Home", "Back", and "Go

Into") to select the path.

2b) Type the name of the new datapool.

2c) If we want to create the RFT project in a ClearCase directory, optionally, select "Add the

datapool to ClearCase".

2d) Next use either of the following steps according to need:

# To create an empty datapool, if there is a filename in the "Import From" list, select the filename and delete it, and then click "Finish".

# To import data into the datapool, click "Next", and then proceed to Step - 4.

Step - 3: Applicable for RFT - VB.NET Scripting:

3a) Type the name of the new datapool.

3b) Either type the path to the desired folder or click "Browse" to browse to the path and folder.

3c) Click "Open".

3d) If we want to create the RFT project in a ClearCase VOB, we can add the datapool to ClearCase after creating it.

3e) Next use either of the following steps according to need:

# To create an empty datapool, if there is a filename in the "Import From" list, select the filename and delete it, and then click "Finish".

# To import data into the datapool, go to the next step.

Step - 4: Importing of Data: To import data from a RFT or IBM Rational TestManager datapool, or from a .csv file take one of the following steps:

# To import a .csv file:

4a) Type the path and filename of an existing .csv file, click the "Import From" arrow to select from a list of ten recently imported files, or click "Browse" to select the path and filename.

4b) Type one to three field separator characters to use in the file we want to import.

Remember that RFT must use the same field separator character as the one used in the .csv file from

which we are importing data. If we are not sure which field separator characters to specify, use a text editor to open the .csv file and see the field separator characters that are used.

Page 17: RFT Tutorial

4c) "Select First Record is Variable Information" to make the first row of the imported data, the header of a new datapool.

If we clear "First Record is Variable Information", the first record in the .csv file is imported as

data and the headers use the default headers, such as data0, data1, etc. "First Record is Variable Information" is unavailable if the file we select to import is not a .csv file or not a TestManager file.

# To import a RFT datapool:

4a) Click the "Import From" arrow to display a list of ten recently imported files, and then select a RFT datapool from the list.

4b) Type the path and filename of an existing RFT datapool.

4c) Click "Browse" to select the path and filename of an existing RFT Datapool.

# To import a TestManager datapool:

Click "Browse TM" to select the path and filename of the TestManager datapool we want to import.

RFT automatically extracts the header information from the associated TestManager .spc file.

Step - 5: Click "Finish".

A newly created datapool gets displayed.

Tutorial - 13 : How to call a script from a IBM RFT - Functional Test Script This article presents a simple method of calling a script from IBM - RFT Functional Test

Script

While recording or editing a RFT script, we can insert a call to a previously recorded script. This allows

us to avoid repeatedly recording similar actions on the application-under-test by taking advantage of scripts that already exist.

Steps to call a script from a RFT script are as under:

Step - 1: In case of recording:

click the "Insert Script Support Commands" button on the Recording Monitor toolbar.

Step - 2: In case of editing:

2a) Position the pointer in the script where we want to place the callScript command.

2b) Click the "Insert Recording into Active Functional Tester Script" button on the RFT toolbar.

2c) Click the "Insert Script Support Commands" button on the Recording Monitor toolbar.

Step - 3: Click the "Call Script tab" in the Script Support Functions dialog box.

Step - 4: In the "Script Name" field, select from the list the name of the script we want to call or enter the name.

Step - 5: In the "Datapool Iterator Count" field, do either of the following according to the need

Page 18: RFT Tutorial

# Type or select the number of records in the datapool.

# Select "Iterate Until Done" to access all records in the datapool.

# Select "Use Current Record" to use the same record across the call script.

Step - 6: Click "Insert Code".

RFT inserts the callScript ("scriptname") code at the cursor location, where scriptname is the name

we had selected in the "Script Name" field.

Step - 7: Click "Close" to remove the Script Support Functions dialog box from the screen.

Important: we can also insert one or more callScript commands by:

a) For RFT - Java Scripting - from the "Functional Tester Projects view".

b) For RFT - VB.NET Scripting - from the "Solution Explorer".

Tutorial - 14 : How to insert a verification point from the script explorer using IBM Rational Functional Tester - RFT

This article presents a simple method of inserting a verification point from the script

explorer using IBM RFT

The most common way to create a verification point is while recording. But we can also insert a

verification point any time from the Script Explorer (in RFT - Java Scripting, the right-most pane and in RFT - VB.NET Scripting, the leftmost pane) in the RFT window when we are not recording.

Steps to insert a verification point while we are not recording are as under:

Step - 1: Start the test application if it is not open.

Step - 2: Open the script we want to insert the verification point into so that it is displayed in the script window.

Step - 3: Put the cursor at the place in the script that we want to insert the verification point.

Step - 4: Right-click "Verification Points" in the Script Explorer, and click "Insert Verification Point".

This will open the Verification Point and Action Wizard.

Step - 5: On the "Select an Object" page, use one of the selection methods to pick the object in the application, and click "Next".

Step - 6: On the "Select an Action" page, select one of the verification point types. Click "Next".

Step - 7: Edit the verification point properties or data.

Step - 8: Click "Finish".

Page 19: RFT Tutorial

The verification point will be added to our script in the location of the cursor, and will be added to the Script Explorer in the Verification Points list.

Important: If we click "Finish" and have no properties or data selected for testing (checked), a warning will display and the script is not modified.

Tutorial - 15 : How to replace an exact match property with a Pattern using IBM Rational Functional Tester - RFT

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 or numeric ranges from within both the Verification Point Editor and the object map.

You can undo any regular expression or numeric range. After you convert a value to a regular

expression or numeric range, the shortcut menu then contains an Undo command, which you can use

to return to the original value.

Steps to use a regular expression from the test object map are as under:

Step - 1: Select the object in the test object map or in the Unification wizard.

Step - 2: In the Recognition Property grid in the map or in the top pane of the Unification wizard, right-click the value to change and select "Convert Value to Regular Expression".

The value is designated as a regular expression by the blue in front of the value text.

Step - 3: Click another property in the grid, and then double-click the value so that we can edit the field.

# Alternatively, we can edit the expression in the "Regular Expression Evaluator".

# To test our regular expression while we edit it, we can use the "Regular Expression Evaluator".

In "Step – 3", right-click the expression, and click "Evaluate Regular Expression".

# The "Pattern" and "Match Against Value" fields contain the current value.

# To try an expression, change the value in the "Pattern" field and click the "Evaluate" button.

# The "Result" indicates whether the expression matched.

Step - 4: Edit the value. For example, if it is a text property of "customer" we can change it as

described here.

# [cC]ustomer : This syntax allows any text that contains the word "customer" with either an

uppercase "C" or lowercase "c" will match. This is important because the comparisons are case-sensitive.

# We can change a case-insensitive comparison by using the Regular Expression Evaluator, or in the

interface of the object map, Verification Point Editor, and Verification Point Comparator.

# In the Regular Expression Evaluator, we can set an option for case sensitivity. The "Perform Case

Sensitive Match" option is on by default. Matching is case-sensitive.

Page 20: RFT Tutorial

# If we want matching to ignore case, we need to clear this option. We can set case sensitivity in the

interface of the object map or the Verification Point Editor and Comparator.

# In these tools, when we right-click on a regular expression value, we can click "Case Sensitive

Regular Expression".

Step - 5: Click outside that cell again.

We are finished if we were in the test object map. If we used the Unification Wizard in the map, click

"Next", and click "Finish".

Step - 6: Click "Save" in the object map.

Tutorial - 16 : How to pass parameters from one script to another by CallScript Method using IBM Rational Functional Tester - RFT

The example uses two different Functional Tester scripts:

a) Script - 1: TheCaller, which calls another script and passes parameters

b) Script - 2: TheCalled, which receives the parameters and prints them to System.out

TheCaller script further uses three different versions of the callScript method:

Version - 1: Without additional parameters: This is the default usage of the callScript method, which will execute the specified script.

callScript("TheCalled");

Version - 2: With additional string array parameter: An array of strings is used to pass string parameters to the called script.

String[] dataToPass = new String[4];

... callScript("TheCalled",dataToPass);

Version - 3: With additional object array parameter: An array of objects is used to pass different object type parameters to the called script.

Object[] objdataToPass = new Object[4];

...

callScript("TheCalled",objdataToPass);

The TheCaller script sample had been recorded as under:

import resources TheCallerHelper;

import com.rational.test.ft.*;

import com.rational.test.ft.object.interfaces.*;

import com.rational.test.ft.object.interfaces.SAP.*;

import com.rational.test.ft.object.interfaces.siebel.*;

import com.rational.test.ft.script.*;

import com.rational.test.ft.value.*;

import com.rational.test.ft.vp.*;

Page 21: RFT Tutorial

/**

* Description : Functional Test Script

* @author Administrator

*/

public class TheCaller extends TheCallerHelper

{

/**

* Script Name : TheCaller

* Generated : Feb 10, 2008 7:24:08 PM

* Description : Functional Test Script

* Original Host : WinNT Version 5.1 Build 2600 (S)

*

* @since 2008/02/10

* @author Administrator

*/

public void testMain (Object[] args)

{

callScript("TheCalled");

String[] dataToPass = new String[4];

dataToPass[0] = "this";

dataToPass[1] = "is";

dataToPass[2] = "really";

dataToPass[3] = "cool";

callScript("TheCalled",dataToPass);

Object[] objdataToPass = new Object[4];

objdataToPass[0] = new String("Thought the previous was cool?");

objdataToPass[1] = "Take this one!";

objdataToPass[2] = new Float(0.02);

objdataToPass[3] = new Integer(4711);

callScript("TheCalled",objdataToPass);

}

}

The TheCalled script uses a simple loop to print the received parameters to System.out:

import resources.TheCalledHelper;

import com.rational.test.ft.*;

import com.rational.test.ft.object.interfaces.*;

import com.rational.test.ft.object.interfaces.SAP.*;

import com.rational.test.ft.object.interfaces.siebel.*;

import com.rational.test.ft.script.*;

import com.rational.test.ft.value.*;

import com.rational.test.ft.vp.*;

/**

* Description : Functional Tester Script

* @author Administrator

*/

public class TheCalled extends TheCalledHelper

{

/**

* Script Name : TheCalled

* Generated : Feb 10, 2008 7:24:08 PM

* Description : Functional Test Script

* Original Host : WinNT Version 5.1 Build 2600 (S)

*

* @since 2008/02/10

* @author Administrator

*/

Page 22: RFT Tutorial

public void testMain (Object[] args)

{

if (args.length < 1)

{

System.out.println( "Expected at least 1 arg, however we got:

"+args.length);

return;

}

else

{

System.out.println( "Got: "+args.length+" args");

}

for (int i = 0; i < args.length; ++i)

{

System.out.println( " arg["+i+"] = "+args[i]);

}

} }