Recording a test against controls
12
Working with Java Applications
Step 7: Recording a test against Drawing Area controls
Now that you have prepared your test script, you are ready to record actions for our test. Before you
begin recording, expand this help topic window so you can see all instructions. If you should need to
scroll in this window after you start recording, press Pause Recording in the Record Status window so
your scrolling actions do not get recorded as part of the test case.
At this point, we assume that you have created and saved your 4Test script file as draw.t. We also
assume that the Record Testcase dialog is open, showing the testcase name as LogMouseMoves and
the application state as DefaultBaseState.
To record actions for verifying the Event Log function:
1 In the Record Testcase dialog, click Start Recording.The recovery system sets the
DefaultBaseState application state for the sample Java application. Once the DefaultBaseState is
established, the Record Status dialog opens and you can start recording your testcase.
2 Move your cursor into the main window of the sample application. When you see Test Application
at the bottom of the Record Status window, select Control/Drawing area.
3 Click once inside the drawing canvas (the gray rectangular area in the Drawing Area window).
Your mouse click is recorded as two mouse events in the Event Log: Button down and Button
up.
4 In the Event Log, drag your mouse pointer to select the text string Button down.
5 With your mouse pointer inside the Event Log, click Ctrl-Alt. The Verify Window dialog appears.
Make sure that JavaAwtTextField DrawingArea.EventLog appears as the window to verify.
6 Click the Method tab, and then check Include inherited to display the 4Test methods available
for the Event Log.
7 Scroll down and select VerifySelText. Look at the description of the VerifySelText. We are going
to use this method to verify that the Event Log correctly recorded the first mouse action in the
drawing canvas, which is Button down, the text you selected in step 4.
8 Click inside the text field labeled, The string or list of string you expect selected. We expect
that the Error Log recorded Button down, so type this text (including the quotation marks):
"Button down"
and then click OK.
9 Repeat steps 4 through 8, this time for the second mouse action, "Button up".
10 Move your cursor over the Exit in the Drawing Area window. When Exit appears in the Record
Status window, click the Exit, and then click Done in the Record Status window. The Record
Testcase window reappears, displaying your actions as translated into 4Test commands.
11 In the Record Testcase window, click Paste to Editor. The testcase LogMouseMoves is pasted
into draw.t
12 Expand the testcase by clicking in LogMouseMoves, and then select Outline/Expand All.