RFT PDF
RFT PDF
January 2005
This document may not be reproduced in whole or in part without the prior written permission of
IBM.
The contents of this manual and the associated software are the property of Rational Software and/or
its licensors, and are protected by United States copyright laws, patent laws, and various international
treaties. For additional copies of this manual or software, please contact Rational Software.
IBM and the IBM logo are trademarks or registered trademarks of IBM Corporation, in the United
States, other countries or both.
Rational, the Rational logo, ClearQuest, ClearCase, ClearCase LT, ClearCase MultiSite, Unified
Change Management, Rational Developer Network, Rational Rose, Rational XDE, Purify,
PureCoverage, Rational Unified Process, ClearDDTS, and Quantify are trademarks or registered
trademarks of International Business Machines Corporation in the United States, other countries or
both.
Microsoft Visual Basic, Windows NT, Windows 2000, Windows 95/98, Windows XP, Microsoft Word,
Windows Explorer, DOS, PowerPoint, and Visual SourceSafe, among others, are trademarks or
registered trademarks of Microsoft Corporation.
Java and all Java-based marks, among others, are trademarks or registered trademarks of Sun
Microsystems in the United States, other countries or both.
UNIX is a registered trademark of The Open Group in the United States, other countries or both.
Other company, product and service names may be trademarks or service marks of others.
Objective
In this lab, you will start the ClassicsCD application and perform some user actions to
get familiar with the application under test.
In this exercise, you will start the ClassicsCD application and perform the types of
user actions you will record in later exercises with Functional Tester.
Steps Comments
1. Start the ClassicsCD application. Use
the desktop shortcut to ClassicsJavaA.
Version A is the build of the application
that is ready for testing by using
Functional Tester. Later, we will see
version B of the application under test.
Steps Comments
6. Enter a credit card number and
expiration date. You can type anything
in here, for instance, 7777 7777 7777
7777, expiration date 07/07.
Objectives
In this lab, you will perform the following tasks:
► View Functional Test perspective.
► Record and play back a simple script.
1.2 Become Familiar with the Script Recording and Playback Process
The purpose of this exercise is to introduce you to Functional Tester and step you
through the process of recording and playing back a script. This is a preview of what
you will be doing in later lab exercises.
Steps Comments
1. If necessary, start Functional Tester:
a. Click Start > Programs > IBM Rational
> IBM Rational Functional Tester V6.1
> Java Scripting.
b. If you need to, connect to the Training-
TST279 project.
2. In the Test perspective, click the Record a
Functional Tester Script icon.
Steps Comments
4. In the Select Script Assets dialog box, We will discuss test object maps
make sure Private Test Object Map is later.
selected in the Test Object Map field. Click
Finish.
Steps Comments
7. Perform the following user actions to place These are the same actions you
an order in the ClassicsCD application: performed in Exercise 0.1.
a. Click the + next to Schubert to expand
the list.
b. Click String Quartets Nos. 4 & 14.
c. Click Place Order.
d. In the Member Logon dialog box, keep
the default settings of Existing Customer
and Trent Culpito. Do not click either of
the password fields. Click OK.
e. Type 7777 7777 7777 7777 in the Card
Number field.
f. Type 07/07 in the Expiration Date field.
8. In the Recording Monitor, click the Insert
Verification Point or Action Command
button. The script pauses, and the
Verification Point and Action Wizard dialog
box opens.
Steps Comments
11. In the Select an Action dialog, click Next. The Perform Data Verification
Point radio button is already
selected.
12. In the Select an Action dialog, click Next and The verification point is
then Finish. recorded, and the script
recording resumes.
13. Click the Place Order button.
14. Click OK on the dialog that indicates that
your order has been received.
15. Click the X in the upper right corner of the
ClassicsCD window to close the application.
16. Click the Stop Recording button in the
Functional Tester Recording Monitor.
Steps Comments
17. In the Test perspective, your script is listed in We will look closely at the
the Project Explorer, and its contents are contents of Functional Tester
displayed in the editor pane. Its test objects scripts in later modules.
are shown in the Script Explorer.
Steps Comments
20. Observe the playback actions and the
messages displayed in the Functional Tester
Playback Monitor.
21. When playback finishes, examine the test log. We will discuss logs in a later
module. For now, just become
If the log does not appear automatically, expand
familiar with the types of
the Training-TST279_logs directory in the
information contained in the
Functional Test Projects Explorer and then
log.
double-click the
Simple_OrderNewSchubertString_01 log.
22. Close the test log.
23. Close the
Simple_OrderNewSchubertString_01 script.
Objectives
In this lab, you will perform the following tasks:
► Record a Data verification point.
► Record a Properties verification point.
► Include script support functions in a script.
► Include a timer in a script.
► Insert recording into a script.
Steps Comments
Steps Comments
Steps Comments
14. In the next screen, the object’s recognition You can see the verification point
properties are displayed. recorded in the Recording
Monitor.
Click Finish.
Steps Comments
21. In the Verification Point Data page, click The verification point is recorded.
Finish.
22. In the application, click the Place Order
button.
23. Click OK on the dialog that indicates your
order has been received.
24. Close the ClassicsCD window and then
stop recording.
25. In the Functional Test perspective, find A later lab exercise will use this
your new script listed in the Functional Test script.
Projects view and double-click to open it in
the Java editor.
26. Now, locate your verification points in the The verification point lines end
script. with performTest(); and you
should see this in the script.
Steps Comments
9. In the Select an Action page, click the
Perform Properties Verification Point
option to indicate that you are recording a
Properties verification point and then click
Next.
Steps Comments
8. In the Recording Monitor, click the Insert
Script Support Commands button.
9. In the Script Support Functions dialog
box, click the Comment tab.
10. Type a comment, such as “Enter credit
card number.”
Click Insert Code and then click Close.
11. In the ClassicsCD application, type 1234
1234 1234 1234 in the Card Number
field.
12. Use the Script Support Functions to insert a
comment, such as “Select AMEX as the
credit card type.” Click Insert Code and
then click Close.
13. Perform the following user actions in the
ClassicsCD application:
a. Select AMEX from the pull-down menu
in the Card Type field.
b. Type 12/07 in the Expiration Date
field.
c. Click the Place Order button.
14. In the Recording Monitor, click the Insert
Verification Point or Action Command
button.
15. Drag the Object Finder tool icon over the In the Select an Action page,
Message dialog so that the whole message notice that the Perform
window is selected and then release the Properties Verification Point
mouse button. Click Next. option is selected by default.
16. Define the properties to test for the
confirmation dialog:
a. The Include Children field should
indicate None.
b. Change the Verification Point Name
to DialogTitle.
c. Click Next.
d. Find the title property and check the
checkbox for it.
e. Click Finish.
Steps Comments
17. In the ClassicsCD application, click OK on
the dialog that indicates your order has
been received.
18. Click the Insert Script Support Commands (Click Insert Code and then click
button, click the Log Entry tab, and insert Close.)
“Order has been placed” as an
informational log entry into your script.
Steps Comments
7. Perform the following user actions in the
ClassicsCD application:
a. Click the Quantity field.
b. Press the Home key.
c. Hold down the Shift key and press the
End key.
d. Press the Delete key.
e. Enter 10 as the quantity.
f. Press the Tab key. (Note: If the tabbing
order in the application changes, the
script may fail. The alternative is to
click in the desired field.)
g. Type 1234 1234 1234 1234 in the
Credit Card number field.
h. Click in the Expiration Date field.
i. Type 12/07 in the Expiration Date
field.
8. In the Recording Monitor, click the Insert
Verification Point or Action Command
button.
9. Select the object to test. Drag the Object
Finder tool icon over the dollar amount
displayed as the total for the order in the
application and then release the mouse
button.
10. Create a Data verification point and name
it TotalSchubertString10. Click Next and
then Finish.
11. In the ClassicsCD application:
a. Click the Place Order button.
b. Click OK on the dialog that indicates
your order has been received.
12. In the Recording Monitor, click the Insert
Script Support Commands button again.
13. In the Script Support Functions dialog Now you are going to stop the
box, click the Timer tab again. timer.
Steps Comments
14. In the Stop Timer field, select the
Order_10 timer.
Click Insert Code and then click Close.
Steps Comments
12. In the Functional Test perspective, look at the Note that the entire script did
new code that has been added to the not have to be recorded again.
VP2_OrderNewBachViolin_02 script. The new recording placed the
code in the desired location to
validate the amount of the
order.
13. Close the VP2_OrderNewBachViolin_02
script, saving your changes.
Objectives
In this lab, you will perform the following tasks:
► Play back a script and view results.
► View a specific log.
► View results from a script containing a verification point.
► Use the Verification Point Comparator.
► Insert a breakpoint into a script.
► Set Functional Tester options and preferences.
6. Scroll through the log to the Stop timer It is okay if your elapsed time is
event. Note the kinds of information different from what is in the
provided for each event. Specifically, look example.
at the Additional Information property
that shows the elapsed time that the timer
calculated.
You may need to view a log from an earlier playback. In this exercise, you will select
and open a specific HTML log.
Steps Comments
1. In the Functional Test Projects view,
expand the Training-TST279_logs icon.
2. In the list of logs, double-click The contents of the HTML log
Simple_OrderNewSchubertString_01 to open in a new window.
display the log.
3. Now double-click the name of a different This is how you select a specific
log. log to be displayed.
4. Close all open log windows.
Steps Comments
1. In the Projects view, double-click the This is the script that contains the
TIMER_OrderNewSchubertString_02 timer.
script to open it.
2. In the Java Editor, locate the line that The line contains a comment.
follows the startApp command. Functional Tester inserts the
Position your cursor on the marker bar to breakpoint at the next command.
the left of this line. Right-click and select
Toggle Breakpoint in the shortcut menu.
5. In the Select Log dialog box, click Finish. Playback action begins.
6. When the Confirm Perspective Switch You can wait until the playback
dialog box opens, click Yes to play back action stops immediately after the
the selected script in Debug mode. start of the application.
7. Execution stops at the first breakpoint
encountered.
In the Functional Test Debug perspective,
click tabs and expand panes to see what
information is displayed in the Debug,
Breakpoints, Script, and Console views. If
the Outline view is not open, open it.
Steps Comments
8. In the Java editor, note that a checkmark The line number in your display
overlays the breakpoint icon, indicating may be different. The line at
that it has been verified by the JRE. which the script is suspended has
green highlighting.
9. Double-click the Debug tab to expand it. Execution is suspended at the
Note the “Suspended” message. breakpoint.
10. Minimize the Functional Test window. Breakpoints may also be useful to
Observe that the application has been get the application under test into
started. a desired state.
11. Restore the Functional Test Debug
window.
12. Click the Debug view Resume button to
continue executing the script.
13. The script continues until the next The cursor should be in the
breakpoint. Look at the ClassicsCD Expiration Date field.
window to see where it stopped on the
application.
14. Return to the Functional Test Debug
perspective and click the Debug view
Resume button to finish executing the
script.
15. Close the test log. Note that Functional Tester
switches back to the Test
perspective.
16. In the Functional Test perspective, in the
script, remove the breakpoints by right-
clicking the breakpoint and then clicking
Toggle Breakpoint in the shortcut menu.
Steps Comments
17. If necessary, close the AUT. Close the
TIMER_OrderNewSchubertString_02 script
9. In the left pane, click Logging. The logging options are displayed
in the right pane.
10. Clear the Use Default checkbox, click the
dropdown menu, and select text.
Steps Comments
12. Run the Note the difference between the
SIMPLE_OrderNewSchubertString_01 text log and the HTML logs you
script and look at the resulting log file. have been viewing. The text log
opens within the workspace in a
tab labeled rational_ft_log.txt
13. Close text log window.
14. On the Functional Test menu bar, select
Window > Preferences again.
15. Reset the log type to HTML and reset the Click Apply after each change.
playback monitor to Show during
playback.
16. In the left pane, click Functional Test. “Multiply all time options by” is
displayed in the right pane.
17. Clear the Use Default box, change the This causes all operations
value in the box to 30.0, and then click controlled by a time option to take
OK. 30 times as long to run.
Objectives
In this lab, you will perform the following tasks:
► Record a script, add code for a message box, and play back the script.
► Record a script, add code to override some preference settings, and play back
the script.
► Run a sample script that has an unexpected active window.
► Edit the script to handle an unexpected active window and play back the script.
► Create a helper class and move the code to handle an unexpected active
window into the helper class.
Steps Comments
16. Insert the following comment line just above
the startApp line:
// This adds a message about the
application starting.
17. Insert the following line just after the Make sure to follow the code
comment line: exactly.
JOptionPane.showMessageDialog(null,"The application will start
next.","Information",JOptionPane.INFORMATION_MESSAGE);
5. Scroll down in the Field Summary to see the We will use the
options that can be customized. BRING_UP_LOGVIEWER and
TIME_MULTIPLIER fields in
this lab exercise.
6. Close the Help window.
7. In the Functional Test Perspective, record a
script called PREF_OrderNewHaydnS94_01.
8. Start the ClassicsJavaA application.
9. Expand the Haydn folder and click
Symphonies Nos. 94 & 98.
10. Click the Place Order button.
11. Log in as Susan Flontly. Log in without a password.
12. Back in the ClassicsCD application, perform The Quantity field should
the following user actions: already contain a value of 1.
a. Click in the Card Number field.
b. Type 5555 5555 5555 5555 in the Card
Number field.
c. Click in the Expiration Date field.
d. Type 12/07 in the Expiration Date field.
13. Create a Data verification point for the total
order amount.
14. Place the order, acknowledge the dialog,
close the application, and stop recording.
15. Play back the script.
16. Accept the defaults for the log.
Steps Comments
17. Review the test log.
18. Close the test log.
19. Enter the following text on the line in the Insert a new line by inserting
script after the startApp line: your cursor at the beginning or
setOption(IOptionName. ending of a line and pressing the
Enter key.
20. The end parenthesis is inserted automatically, If the list doesn’t automatically
and the Content Assist option list pops up. appear, you can bring it up by
Scroll down the options (or type the first placing your cursor at the end of
letter or two) and double-click the text (after the period but
TIME_MULTIPLIER. before the end parenthesis) and
then holding down the Ctrl key
and pressing the space bar.
21. Finish the line with ,10.0 );. Make sure to include a decimal
point with the new time value.
22. Add a line of code before the new setOption
line instructing Functional Test to display a
message about the current value and add a
line of code after the new line to display a
message about the new value. The finished
code should look like this:
23. Go to the line just before the input keys for This is useful when you want the
the expiration date and reset the time time value in question to be in
multiplier to the default value. Print the effect for only part of the test.
default value in the console window.
Steps Comments
24. This part of the script should look like the
following:
resetOption(IOptionName.TIME_MULTIPLIER);
System.out.println("Reset time multiplier to default= “+
getOption(IOptionName.TIME_MULTIPLIER));
placeAnOrder().inputKeys("{ExtHome}+{ExtEnd}{ExtDelete}12/07");
25. Play back the script and accept the defaults
for the log.
26. Review the test log and then close the log.
27. In the Console view, look at the messages
your script displayed.
Suppose that you just started a test and an unexpected dialog appears. This lab will
show you how to handle this condition.
Steps Comments
1. Run the script called This script allows an unexpected
UAW_OrderNewMozartS34_01. active window to stay on the
screen.
2. Accept the defaults for the log. It may take up to a minute to
finish and display the log.
3. Look at the Properties of the log message. The commands to expand the
tree could not execute because
the message window was active.
You will edit the script to handle
this condition.
4. Close the test log.
5. Click OK to close the Message box and then You may have to use the
close the ClassicsCD application. Windows Task Manager to end
the ClassicsCD application.
6. In the Functional Test perspective, make sure
the UAW_OrderNewMozartS34_01script is
open.
Steps Comments
7. Insert two blank lines above the last brace } This is where you will paste a
in the script. method that handles test object
exceptions.
8. Click Help > Functional Test API
Reference.
9. Expand the API Reference.
10. Click com.rational.test.ft.script.
Steps Comments
16. On the next line after the public void line,
insert a left brace {. Then press Enter to
move to the next line.
17. Enter the following text:
21. A sample of what the end of your script Make sure you do not have too
should look like is on the next page. many braces. If you cannot
make the script run, look at
and/or copy script lines from the
Solutions project. See your
instructor for help on this.
22. Close the Help window and run the script. Accept default log information.
See that it now handles the unexpected
active window.
23. Close the test log.
24. Close the UAW_OrderNewMozartS34_01
script.
4.4 Create a Java helper class and put the unexpected active
window code in it
Steps Comments
1. In the Functional Test Projects view,
right-click the Training-TST279
project.
2. Click Add Test Folder.
3. In the Test folder name box, type
superScripts and then click Finish.
4. Click the New button.
5. Expand the Java category. Click Class The Java Class dialog box opens.
and then click Next.
Steps Comments
8. Clear the Inherited abstract methods
check box.
Steps Comments
15. Open the Select the code that begins with
UAW_OrderNewMozartS34_01 script public void
and copy all the code that you wrote onTestObjectMethodException
to handle unexpected active windows. and ends with the second-to-last line
of the script, which contains a single
right brace }.
16. Paste the copied code into the UAW The UAW helper class text should be
helper class (at the current cursor similar to the following:
position).
package superScripts
import com.rational.test.ft.object.interfaces.*;
import com.rational.test.ft.script.*;
"com.rational.test.ft.WindowActivateFailedException") )
{
IWindow activeWindow =
getScreen().getActiveWindow();
if (activeWindow != null)
{
System.out.println("Unexpected active window
caption =
"+activeWindow.getText());
activeWindow.inputKeys("Enter{Enter}");
testObjectMethodState.findObjectAgain();
}
else
super.onTestObjectMethodException(testObjectMethodState,
foundObject);
}
else
super.onTestObjectMethodException(testObjectMethodState,
foundObject);
}
}
Steps Comments
17. In the Projects view, right-click the
UAW_OrderNewMozartS34_01 script
and then click Properties.
18. Click Functional Test Script.
19. In the Helper superclass box, delete
the existing text and type
superScripts.UAW and then click OK.
Objectives
In this lab, you will perform the following tasks:
► Display a test object map.
► Create and use a shared test object map.
► Modify a test object map.
2. In the Test Object Hierarchy pane, expand These are the test objects you
all of the test objects by clicking the + accessed during recording.
signs.
Steps Comments
4. On the Object Map: Help Page, clear the
checkbox at the bottom of the page and
click Finish.
5. Close the Test Object Map window.
6. In the Projects View, find your new test
object map.
7. Open the
Simple_OrderNewSchubertString_01
script. Notice (in the Script Explorer) that it
is now associated with the SimpleMap test
object map instead of a private test object
map.
7. Close the
Simple_OrderNewSchubertString_01
script.
8. Record a new script: Clicking Next opens the Select
Test Object Map dialog box, in
a. Name the script
which you can specify the object
Simple_OrderNewSchubertS5_01.
map with which you want to
b. Do not check the Add the script to associate the script.
Source Control box if it is displayed.
c. Click Next.
9. In the Select Test Object Map dialog box: Your new test object map will be
associated with this script. We also
a. If not already selected, browse to
ensured that SimpleMap remains
select /SimpleMap.rftmap Test Object
the default test object map for
Map.
new scripts.
b. In the Set as test asset default for
new scripts in this project area, check
the Test Object Map option.
c. Click Finish.
Steps Comments
Steps Comments
14. Note that the SimpleMap test object map is SimpleMap appears in the Projects
listed in both the Projects view and the view because it is a shared map. (It
Script Explorer. is a shared map because it was
created independently, not as part
of the process of creating a script.)
SimpleMap also appears in the
Script Explorer because it is
associated with the active script in
the Script view.
15. Close the
Simple_OrderNewSchubertS5_01 script.
16. Create another simple script, named We will use this script to
Simple_TCViewOrder_01, using the demonstrate sharing of the map.
SimpleMap test object map.
17. In the Recording Monitor, start the
ClassicsJavaA application.
18. Perform the following user actions:
a. On the menu, click Order.
b. Click View Existing Order Status.
c. Click OK in the login dialog box.
Steps Comments
23. Open the SimpleMap test object map and Notice the new objects that are
expand all of the objects. (Do not close the listed now. The
map after reviewing it.) Simple_TCViewOrder_01 script
added test objects to the map.
In this exercise, you will modify your shared test object map in various ways and
demonstrate that both scripts that use this map can “see” the changes.
Steps Comments
1. In the Test Object Map window The test object is now listed in
(SimpleMap), note that all test objects are black type and is no longer
marked New and listed in blue type. marked as New.
Right-click the first top-level object in the
hierarchy and click Accept Node in the
shortcut menu.
Steps Comments
4. In the Recognition tab, find the name
property for this test object. Double-click
the associated value field and change the
value to .creditCardNumberField.
6. Right-click any object and then click Note that all of the test objects are
Accept All in the shortcut menu. now listed in black type, and they
are no longer listed as New.
Steps Comments
7. Scroll to the ClassicsJava: ClassicsJava You will enter some descriptive
frame. Right-click the placeOrderButton2 information about the object.
button under it and then click Description
Property in the shortcut menu.
Steps Comments
11. Close the Simple_TCViewOrder_01 script.
12. Open the
Simple_OrderNewSchubertS5_01 script.
13. In the Script Explorer, double-click
/SimpleMap.rftmap to open the
SimpleMap test object map.
14. Expand all objects and find the objects that All of the test objects reflect your
you modified. Verify that this script can modifications. The shared test
“see” the modifications. For example, are object map really is shared!
all the objects now accepted? There should
be no “new” designations. Does the
description for the placeOrderButton2 that
you entered appear in the Administrative
tab?
15. Close the Test Object Map window.
16. Close the
Simple_OrderNewSchubertS5_01 script.
Objectives
In this lab, you will perform the following tasks:
► Set recognition score thresholds.
► Set up pattern-based recognition.
► Update the baseline for a verification point.
Steps Comments
Steps Comments
18. Click the Restore Defaults button.
19. Clear the Use Default check box next Our DefaultScores log indicates that
to Warn if accepted score is greater the RememberPassword object
than and set the value to 20000. Click recognition score was 20000 while
OK. the warning threshold was 10000, the
default.
20. Play back the
VP1_OrderNewBachViolin_01 script.
Name the log WarnScores
21. When playback finishes, view the test Note that there is no warning.
log.
4. Right-click Remember Password and then Note that the value is now
click Convert Value to Regular Expression designated as a regular expression
in the shortcut menu. by the blue “xy.”
5. Double-click the Remember Password
value and type .* between Remember and
Password. (Be sure to include the period.)
Steps Comments
8. When playback finishes, view the test log Because we used a regular
and expand all events. expression, there is no warning
about finding the object with the
default recognition scores.
However, the data captured by
the VP is different from the
baseline data so the VP still fails.
9. Click the View Results hyperlink at the The Verification Point Comparator
bottom of the Fail details pane. opens.
10. Click the Replace Baseline with actual
value button.
Steps Comments
1. Open the Training-TST279
project.
2. On the main menu, click File >
New > Test Datapool.
3. In the Create Test Datapool The location should be within the
dialog box: Functional Tester project.
a. Accept the default location.
b. Name the datapool
OrderTotalData.
c. Click Next.
4. In the Import Datapool dialog
box, browse to and select the
following file: C:\Training-
TST279\ClassicsOrders.csv.
5. Accept other defaults and click The datapool is imported into the project.
Finish. Notice the datapool in the project
directory.
6. Check the data to see that the You should have seven rows of data (zero
datapool has imported correctly. through six).
Steps Comments
1. In the Datapool Editor, in the The Edit Variable dialog box opens.
variables row of the datapool,
click in the column heading that
contains the number 1.
Steps Comments
1. Start recording a new test script:
a. Name the script
OrderTotal2.
b. Accept the default location
and click Next.
c. On the Select Script Assets
page, accept all default
settings and click Finish.
2. Start ClassicsJavaA. Recording begins.
a. In the Recording dialog box,
click the Start Application
button.
b. In the Applications list, verify
that ClassicsJavaA – java is
selected and click OK.
3. In ClassicsCD, select the The Member Logon window opens.
Beethoven Symphony No. 9 CD
and then click Place Order.
4. Log in as existing customer Trent
Culpito (no password) and click
OK.
5. Click in the Quantity box. Press
[HOME] [SHIFT+END]
[DELETE] and then type 1.
6. In the Card Number box type:
1234 1234 1234 1234 and in the
Expiration Date box type: 12/08.
Steps Comments
7. Create a Total verification point
for the total dollar amount due.
a. On the Recording toolbar,
click the Insert Verification
Point or Action Command
button.
b. Click the Object Finder
button, hold the mouse
button down, and drag the
Object Finder over the total
dollar amount due ($16.99).
c. Release the mouse button.
d. In the Verification Point and
Action Wizard dialog box,
verify that Perform Data
Verification Point is selected
and then click Next.
e. In the Verification Point
Name box, type Total.
f. Click Next.
g. Click Finish.
8. Complete the order and stop
recording.
a. Click Place Order.
b. In the message box, click
OK.
c. Close the ClassicsCD
application.
d. In the Recording toolbar,
click the Stop Recording
button.
e. If necessary, close the Test
Object Map window.
9. Play back the script.
a. Click the Run Functional
Test Script button.
b. Accept the default log name
and click Finish.
c. View the log.
d. Close the log.
Steps Comments
1. Under the Projects view, right-
click the OrderTotalData
datapool and then click
Associate with Script on the
shortcut menu.
2. In the Associate the datapool
with scripts dialog box, if
necessary, expand the Training-
TST279 project node, check the
box to select the OrderTotal2
script, and then click Finish.
3. If necessary, close the Datapool
Editor.
Steps Comments
1. To change the verification point We are still working with the OrderTotal2
reference from a literal to a script.
variable, in the Script Explorer,
double-click the Total
verification point to open the
Verification Point Editor.
2. Click the Convert Value to
Datapool Reference button.
3. In the Datapool Reference Once you change the verification point
Converter dialog box, select reference, the literal value is changed to
Total from the Datapool Variable the variable reference.
drop-down list and then click
OK.
4. Save changes and close the
Verification Point Editor.
Steps Comments
1. If necessary, open the
OrderTotal2 script.
2. In the Script Editor, scroll to When Functional Tester replaces the literal
find the line in the script that “{ExtHome}+{ExtEnd}{ExtDelete}1”
sets the quantity: with a datapool reference to the Quantity
placeAnOrder().InputKeys variable, the key sequence that clears the
(“{ExtHome}+{ExtEnd} box before typing quantity will be lost
{ExtDelete}1”); unless you put it on its own line.
3. Copy the line and paste it into a
blank line immediately below
the line you copied.
4. In the first of the two matching
lines, delete the 1.
5. Click Script > Find Literals The Datapool Literal Substitution dialog
and Replace with Datapool box opens.
Reference.
6. In the Datapool Literal
Substitution dialog box, verify
that All is selected under Literal
Type.
7. Click Find until the literal for Depending on the cursor position in the
the quantity, script, you may already be on the line.
“{ExtHome}+{ExtEnd}{ExtDe
lete}1” displays in the Literal
box.
8. In the Datapool Variable box, Notice in the Script Editor that the quantity
select Quantity from the drop- literal value is replaced by the variable
down list and then click “Quantity.”
Replace.
9. Click Find until the literal for
the credit card number, 1234
1234 1234 1234, displays in
the Literal box.
10. In the Datapool Variable box, Notice in the Script Editor that the credit
select CreditCardNum from card number literal value is replaced by the
the drop-down list and then variable “CreditCardNum.”
click Replace.
Steps Comments
11. In the Datapool Literal
Substitution dialog box, click
Find until the literal for the
expiration date displays in the
Literal box.
12. In the Datapool Variable box, Notice in the Script Editor that the
select ExpDate from the drop- expiration date literal value is replaced by
down list and then click the variable “ExpDate.”
Replace.
13. Click Close. The literals for quantity, credit card
number, and expiration date are now
replaced in the script with variables.
Sample script (Your script should look similar to the following in the Place an Order
section. It is okay if you do not have "{ExtHome}+{ExtEnd}{ExtDelete}" keystrokes
before the Credit Card Number and Expiration Date input fields. ):
Steps Comments
1. Run the test script. The Select Log dialog opens.
2. Name the test log
OrderTotal2_run002 and click
Next.
3. For the Datapool Iterator The script runs. It will run four times, each
Count, select 4 and then click time drawing data from a different row in
Finish. the datapool.
4. When the test script finishes,
view the results in test log.
5. In the test log, scroll down to This verification point should have failed.
the results of the first Can you tell why?
verification point, and click
View Results.
6. In the Verification Point Notice that there is an extra space after the
Comparator, click the Show $16.99 in the expected value column.
Hidden Characters button. There is an extra space after that value in
the datapool.
7. Close the Verification Point
Editor and test log.
8. In the Projects view, double-
click the OrderTotalData
datapool to open it in the
Datapool Editor.
9. Double-click the cell in the Check the other cells in the column to
Total column that contains verify that there are no extra spaces in the
$16.99. Delete the extra space cells.
after $16.99.
10. Save changes and close the
Datapool Editor.
11. Re-run the OrderTotal2 script
and view the results in the test
log.
12. Close any open test logs,
scripts, and datapools.
Steps Comments
1. Start recording a new functional The Functional Tester window is
test. minimized, and the Recording dialog box
a. Name the script opens.
OrderTotal3_part1 and then
click Next.
b. On the Select Script Assets
page, accept all default settings
and click Finish.
2. Start ClassicsJavaA.
a. In the Recording dialog box, The Start Application dialog box opens.
click the Start Application
button.
b. In the Application Name list, The ClassicsCD window opens.
verify that ClassicsJavaA –
java is selected and click OK.
3. Select the Haydn Violin To select the Haydn Violin Concertos CD,
Concertos CD and then click expand the Haydn folder and then click
Place Order. Violin Concertos.
The Member Logon dialog box opens.
4. Log in as Trent Culpito. The Place an Order dialog box opens.
a. Verify that Trent Culpito is
displayed in the Full Name
box.
b. Click OK.
5. On the Recording toolbar, click Recording is paused and the Insert Data
the Insert Data Driven Driven Actions dialog box opens.
Commands button.
6. In the Place an Order dialog box,
Card Number box, type 1234
1234 1234 1234.
7. In the Expiration Date box, type
12/08.
8. In the Insert Data Driven Actions The Insert Data Driven Actions dialog box
dialog box, use the object finder disappears, and the mouse pointer is
to select the entire Place an changed to a small blue hand.
Order window. When the Place an Order dialog box is
selected, a red border is displayed around
the entire dialog box.
Steps Comments
9. In the Variable column, rename Double-click the variable to edit its value.
the first six variables as follows:
Test Object Variable
ItemText Composer
_1499Text Item
QuantityText Quantity
CardNumberIncludeThe CardNumber
SpacesText
CreditCombo CardType
ExpirationDateText ExpDate
10. For each of the last four rows,
select the row and then click the
Delete the selected row from
the commands table button.
11. Click OK. The Insert Data Driven Actions dialog box
closes and recording resumes.
Steps Comments
12. Create a Total verification point
for the total dollar amount due.
a. On the Recording toolbar, Recording is paused, and the Verification
click the Insert Verification Point and Action Wizard dialog box, Select
Point or Action Command an Object page opens.
button.
b. Click the Object Finder button The Verification Point and Action Wizard
and hold the mouse button dialog box disappears, and the mouse
down. pointer is changed to a small blue hand.
c. Drag the Object Finder over When the total amount is selected, a red
the total dollar amount due border is displayed around the text $15.99.
($15.99).
d. Release the mouse button. The Verification Point and Action Wizard
dialog box, Select an Action page opens.
e. In the Verification Point and The Insert Verification Point Data
Action Wizard dialog box, Command page opens.
verify that Perform Data
Verification Point is selected
and then click Next.
f. In the Verification Point Name
box, type Total.
g. Click Next. The Verification Point Data page opens,
displaying the selected object and its
recognition properties.
h. Click Finish. The Verification Point and Action Wizard
dialog box closes and recording resumes.
13. Complete the order, exit
ClassicsCD, and stop recording.
a. Click Place Order. A message box opens indicating that your
order has been received.
b. Click OK.
c. Click the Close button to exit
ClassicsCD.
d. In the Recording toolbar, click The new script opens in the Script Editor.
the Stop Recording button.
e. If necessary, close the Test
Object Map window.
14. Play back the script.
a. Click the Run Functional Test
Script button.
b. Accept the default log name
and click Finish.
Steps Comments
15. View the results and close the
test log.
Steps Comments
1. In the Script Explorer, under The Verification Point Editor opens
Verification Points, double-click displaying the expected value for the Total
the Total VP. VP.
2. On the Verification Point Editor The Datapool Reference Converter dialog
toolbar, click the Convert Value box opens.
to Datapool Reference button.
3. In the Datapool Variable box,
type Total.
4. Verify that the Add value to new
record in datapool option is
selected.
5. Click OK.
6. Close the Verification Point
Editor.
7. In the Save Verification Point
message box, click Yes to save
your changes.
Steps Comments
1. In the Script Explorer, double-
click Private Test Datapool.
2. In the second row of the Double-click the quantity to edit its value.
datapool, change the quantity to
2 and the total to $30.98.
3. Save your changes.
4. Play back the script, assigning a
new log name and playing
through two iterations.
a. Click the Run Functional Test
Script button.
b. Name the log
OrderTotal3_part1_run2.
c. Click Next.
d. In the Datapool Iteration
Count box, select 2.
e. Click Finish.
5. View the results and then close
the test log.
Steps Comments
1. In the Script Explorer, right-click The Export page opens.
Private Test Datapool and then
click Export.
2. Click Browse.
3. Navigate to C:\Training-TST279
and name the file
OrderTotalData2.csv.
4. Click Save. You are returned to the Export page.
5. Click Finish.
6. Open Windows Explorer, The datapool opens in Microsoft Excel.
navigate to C:\Training-TST279, The datapool contains a row of column
and double-click headings followed by two rows of data.
OrderTotalData2.csv.
7. Copy row 3 and paste it into
rows 4 through 6.
8. Edit rows 4 through 6 as follows:
Row Quantity Total
4 5 $75.95
5 10 $150.90
6 50 $750.50
9. Save the file and close Excel.
10. Close Windows Explorer.
Steps Comments
1. Start recording a new script
named OrderTotal3_part2.
2. Start ClassicsJavaA. The ClassicsCD window opens.
3. Select the Haydn Violin The Member Logon dialog box opens.
Concertos CD and then click
Place Order.
4. Log in as Trent Culpito. The Place an Order dialog box opens.
5. Clear the Quantity box and then To clear the box:
type 2. 1. Press Home.
2. Press Shift+End.
3. Press Delete.
6. Clear the Card Number box and
then type 2222 2222 2222 2222.
7. Clear the Expiration Date box
and then type 12/08.
8. Create a verification point named
Total for the total dollar amount
due ($30.98).
9. Complete the order, exit The new script is opened in the Functional
ClassicsCD, and stop recording. Tester main window.
10. If necessary, close the Test
Object Map window.
Steps Comments
1. In the Functional Tester main
window, click File > New >
Test Datapool.
2. Accept the default location, and
in the Name box, type
OrderTotal3.
3. Click Next. The Import Datapool page opens.
4. Click Browse.
5. Navigate to C:\Training-TST279
and double-click
OrderTotalData2.csv.
6. Select the First Record is With this option selected, Functional Tester
Variable Information option. interprets the first record in the CSV file as
column headings rather than data.
7. Click Finish. The new datapool is opened in the
Functional Tester main window.
The data from OrdersTotal2.csv is now
contained in a new datapool
(OrderTotal3.rftdp). For Functional Tester
to use this data during test script playback,
the datapool must be associated with the
test script.
8. If you have rows that are empty,
right-click the row number and
select Remove Record.
Steps Comments
9. Close the TestDatapool Click the X in the upper right corner of the
(OrderTotal3.rftdp) and save the view.
changes, if necessary.
10. In the Script Explorer, right-click The OrderTotal3_part2 script should be
Test Datapool. open.
11. Click Associate with Datapool. The Select Test Datapool dialog box opens
displaying a list of datapools contained in
the current project.
12. Click /OrderTotal3.rftdp and The datapool is listed under Test Datapool
then click OK. in the Script Explorer.
Steps Comments
1. In the OrderTotal3_part2 script, When Functional Tester replaces the literal
find and copy the line that sets “{ExtHome}+{ExtEnd}{ExtDelete}2”
the quantity: with a reference to the Quantity variable,
placeAnOrder().inputKeys the key sequence that clears the box
(“{ExtHome}+{ExtEnd} before typing the quantity will be lost
{ExtDelete}2”); unless it is retained in a line of its own.
2. Paste the line into a blank line
immediately after the line that
you copied.
3. In the first of the two matching
lines, delete the value 2.
4. Click Script > Find Literals and The Datapool Literal Substitution dialog
Replace with Datapool box opens.
Reference.
5. Click Find until you find the
following literal:
”{ExtHome}+{ExtEnd}-
{ExtDelete}2”
6. In the Datapool Variable list,
select Quantity.
7. Click Replace. In your script, Functional Tester replaces
the literal value 2 with a reference to the
Quantity variable in the RoundTrip
datapool.
8. Click Close.
9. In your script, find the line that Now that the script will use quantities
sets the quantity and verify that defined in the datapool, we must update
the literal has been replaced by a the Total VP to use its corresponding values
reference to the Quantity defined in the datapool. Otherwise the VP
variable: expected result will be $30.98 regardless of
(dpString(“Quantity”)) the quantity of CDs ordered.
10. Restart Functional Tester and If prompted, click Yes to Save Resources.
open the Training-TST279
project.
11. If necessary, open the
OrderTotal3_part2 script and
close the Datapool editor.
12. In the Script Explorer, double- The Verification Point Editor opens.
click the Total VP.
Steps Comments
13. In the toolbar above the right The Datapool Reference Converter dialog
pane, click the Convert Value to box opens.
Datapool Reference button.
14. In the Datapool Variable box,
select Total.
15. If necessary, clear the Add value
to new record in datapool check
box.
16. Click OK. Verify that the right pane of the Verification
Point Editor now displays Total instead of
$30.98.
17. Close the Verification Point
Editor.
18. In the Save Verification Point
message box, click Yes to save
your changes.
19. Play back the script, naming the You may need to click the script view to
log OrderTotal3_part2_run3 make it active before you can play it back.
and setting the iteration count When playback is complete, the log opens
to 5. in a browser window.
20. Examine the test results. Did any verification points fail? If so, how
can you fix the problem?
If you are unsure, ask your instructor for
further assistance.
21. If necessary, fix problems and
play back the script again.