- When you start integtest, it looks like this. The Control Script
tab is on selected.
Integtest supports merging several event files (.dir) into a
sigle control script.
It's generally easier to write short tests as .dir files, and
combine them into larger test sets in .scr files.
- After you select the Event Script tab, it looks like this.
The text window displays commands to be sent to the target application,
one command per line. A file can be loaded via
the File menu. The text window can be edited directly, or the
action buttons can be used to construct commands.
- The button bar is divided into four sets of actions:
- The icons along the task bar are:
- A target application might resemble this. The only change from
a "normal" application is adding a test for a "-debug" command line
argument, source'ing the socket code, and opening a socket.
#
# Example of interaction window
#
#######################################
# INSTRUMENTATION FOR INTEGTEST
if {[lsearch $argv -debug] != -1} {
# Load the socket client code
source integClient.tcl
# Start the connection to a local instance
inttest::integClientOpen 127.0.0.1 3010
}
# END OF INSTRUMENTATION FOR INTEGTEST
#######################################
# Update the displayed text in a label
proc updateLabel {myLabel item} {
global price;
$myLabel configure -text \
"The cost for a potion of $item is $price gold pieces"
}
# Create and display a label
set l [label .l -text "Select a Potion"]
grid $l -column 0 -row 0 -columnspan 3
# A list of potions and prices
set itemList [list "Cure Light Wounds" 16 \
"Boldness" 20 \
"See Invisible" 60]
set position 0
foreach {item cost} $itemList {
radiobutton .b_$position -text $item -variable price \
-value $cost -command [list updateLabel $l $item]
grid .b_$position -column $position -row 1
incr position
}
- A common action to perform in the target application is to
click on a menu or button. The ! button invokes a button or
menu in the target.
After clicking a "Invoke" (the ! icon) you get this window
with a tree to select the widget to receive the event.
If you know the application's window hierarchy, you can browse to
it easily. If you aren't certain which widget you need to select,
you can right-click on an item and it will flash green and red in
the target application.
- After selecting Done, the main integtest screen will
resemble this. The command is Invoke and the arguments to that command
are -pattern .b_0 -class Button. Commands can be created and edited
by hand. The -pattern option in this example is the name of the button.
If you have an application that creates new frames with different names, you
might use a pattern like .frame*.b_0.
- Clicking the blue arrow (
) will run all the commands
in the Event Script window. After clicking the Run button
the application behaves as if a user had clicked
the Cure Light Wounds radiobutton.
- After you click the Run button a new window will be displayed,
showing the tests and results. In this case, there is just the single test,
which can't fail.
- The test developer should now confirm that the target application has
performed as intended.
The six Examine buttons introspect the target application and save
the results to be compared to later test runs.
In this example, we can see that the label has been modified. We select
one of the Examine Window (
) tests.
If your application will only be used on one platform, and maintaining
consistent background colors is important, choose the colored icon. If it
will run on multiple platforms, the background colors are likely to be different
depending on the platform. In that case, choose the uncolored icon.
It can be frustrating to check inconsistencies that don't matter.
Clicking a window button will bring up the same window browsing
menu. Again, select the appropriate entry and click Done
- After clicking the Done button, integtest will query the
label and generate a new command in the events window. That window will
now resemble this:
- Clicking the blue Run button (
) will update the
results window like this.
- The Event Script window is editable. To demonstrate an application
qnot behaving as expected, I've changed .b_0 to .b_1
- When this is run, the application shows the new button being clicked.
and the results window resembles this:
- Clicking the Examing button brings up this screen which highlights
the differences between what was expected and what happened.