|
Packit |
b099d7 |
.\" Motif
|
|
Packit |
b099d7 |
.\"
|
|
Packit |
b099d7 |
.\" Copyright (c) 1987-2012, The Open Group. All rights reserved.
|
|
Packit |
b099d7 |
.\"
|
|
Packit |
b099d7 |
.\" These libraries and programs are free software; you can
|
|
Packit |
b099d7 |
.\" redistribute them and/or modify them under the terms of the GNU
|
|
Packit |
b099d7 |
.\" Lesser General Public License as published by the Free Software
|
|
Packit |
b099d7 |
.\" Foundation; either version 2 of the License, or (at your option)
|
|
Packit |
b099d7 |
.\" any later version.
|
|
Packit |
b099d7 |
.\"
|
|
Packit |
b099d7 |
.\" These libraries and programs are distributed in the hope that
|
|
Packit |
b099d7 |
.\" they will be useful, but WITHOUT ANY WARRANTY; without even the
|
|
Packit |
b099d7 |
.\" implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
Packit |
b099d7 |
.\" PURPOSE. See the GNU Lesser General Public License for more
|
|
Packit |
b099d7 |
.\" details.
|
|
Packit |
b099d7 |
.\"
|
|
Packit |
b099d7 |
.\" You should have received a copy of the GNU Lesser General Public
|
|
Packit |
b099d7 |
.\" License along with these librararies and programs; if not, write
|
|
Packit |
b099d7 |
.\" to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
|
|
Packit |
b099d7 |
.\" Floor, Boston, MA 02110-1301 USA
|
|
Packit |
b099d7 |
...\"
|
|
Packit |
b099d7 |
...\"
|
|
Packit |
b099d7 |
...\" HISTORY
|
|
Packit |
b099d7 |
# $XConsortium: ch04.sm /main/3 1995/07/13 20:09:16 drk $
|
|
Packit |
b099d7 |
...\" (c) Copyright 1992 OPEN SOFTWARE FOUNDATION, INC.
|
|
Packit |
b099d7 |
.H 1 "Debugging the Automated Tests"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
Interpreting test results often requires debugging each individual
|
|
Packit |
b099d7 |
discrepancy until its cause can be determined. The follow sections
|
|
Packit |
b099d7 |
describe how the automation technology supports debugging.
|
|
Packit |
b099d7 |
.H 2 "Types of Failures"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
This section describes the types of failures which may be found by automated
|
|
Packit |
b099d7 |
testing. The next section provides some hints on how to go about debugging
|
|
Packit |
b099d7 |
those failures.
|
|
Packit |
b099d7 |
.H 3 "Visual Comparison Failures"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
A common visual comparison failure occurs when the original, recorded image
|
|
Packit |
b099d7 |
differs in size from the current image under test. Because the automation
|
|
Packit |
b099d7 |
code does not know how to compare different-sized images, it simply issues
|
|
Packit |
b099d7 |
a warning. In interactive mode, the original region will be
|
|
Packit |
b099d7 |
displayed in the dialog box, although the overlay feature is disabled.
|
|
Packit |
b099d7 |
One can, however, use the X client \*Lxmag\*O and count pixels to help
|
|
Packit |
b099d7 |
determine what has changed.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
When two images are the same size, the automation code does a pixel-by-pixel comparison of the images. If any one pixel differs between the
|
|
Packit |
b099d7 |
two images, the automation code prints out a message that a CompareVisual
|
|
Packit |
b099d7 |
failure has occurred.
|
|
Packit |
b099d7 |
In interactive mode, the tester can examine both
|
|
Packit |
b099d7 |
the recorded and current images, and overlay the differences (highlighted
|
|
Packit |
b099d7 |
in red) on top of either image.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
There are several problems that can produce a \*LVisual Image Not Found\*O
|
|
Packit |
b099d7 |
error:
|
|
Packit |
b099d7 |
the recorded
|
|
Packit |
b099d7 |
image is missing or corrupted; the environment variable
|
|
Packit |
b099d7 |
\*L$AUTOVPATH\*O is not defined; the directory defined by
|
|
Packit |
b099d7 |
\*L$AUTOVPATH\*O does not
|
|
Packit |
b099d7 |
exist, or the visual file in that directory is not readable or is missing.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
This error can also occur if the test or the script was modified between
|
|
Packit |
b099d7 |
the recording and the playback. For instance, a test is recorded
|
|
Packit |
b099d7 |
with a script that specifies six visual comparisons. Six images are
|
|
Packit |
b099d7 |
stored in the \*L.vis\*O file. Later, a tester adds an additional
|
|
Packit |
b099d7 |
\*LCompareVisual\*O command to the script but fails to rerecord the test.
|
|
Packit |
b099d7 |
On the next playback, the seventh visual comparison fails because no
|
|
Packit |
b099d7 |
image is stored with which to compare the current image.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
Either a \*LChecksum\*O or a \*LVisual Image Corrupt\*O error can occur
|
|
Packit |
b099d7 |
when something in the visuals file has become corrupted. The only way to
|
|
Packit |
b099d7 |
fix this problem is to rerecord the original, using the original baseline.
|
|
Packit |
b099d7 |
.H 3 "Fatal Errors"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
The signals are trapped by the automation code, and redirected to
|
|
Packit |
b099d7 |
a special routine \fBAutoExitSignal\*O which simply prints out a "signal received" message, and the type of signal. Signals so captured are:
|
|
Packit |
b099d7 |
.sp
|
|
Packit |
b099d7 |
.in +3
|
|
Packit |
b099d7 |
.VL 1i
|
|
Packit |
b099d7 |
.LI "\*LSIGHUP\*O"
|
|
Packit |
b099d7 |
hangup
|
|
Packit |
b099d7 |
.LI "\*LSIGINT\*O"
|
|
Packit |
b099d7 |
interrupt
|
|
Packit |
b099d7 |
.LI "\*LSIGQUIT\*O"
|
|
Packit |
b099d7 |
quit
|
|
Packit |
b099d7 |
.LI "\*LSIGKILL\*O"
|
|
Packit |
b099d7 |
kill
|
|
Packit |
b099d7 |
.LI "\*LSIGSEGV\*O"
|
|
Packit |
b099d7 |
segmentation violation
|
|
Packit |
b099d7 |
.LI "\*LSIGFPE\*O"
|
|
Packit |
b099d7 |
arithmetic (floating point) exception
|
|
Packit |
b099d7 |
.LI "\*LSIGILL\*O"
|
|
Packit |
b099d7 |
illegal instruction
|
|
Packit |
b099d7 |
.LI "\*LSIGTERM\*O"
|
|
Packit |
b099d7 |
software termination signal
|
|
Packit |
b099d7 |
.LI "\*LSIGABRT\*O"
|
|
Packit |
b099d7 |
abort
|
|
Packit |
b099d7 |
.LI "\*LSIGBUS\*O"
|
|
Packit |
b099d7 |
bus error
|
|
Packit |
b099d7 |
.LI "\*LSIGSYS\*O"
|
|
Packit |
b099d7 |
bad argument to system call
|
|
Packit |
b099d7 |
.LE
|
|
Packit |
b099d7 |
.in -3
|
|
Packit |
b099d7 |
.sp
|
|
Packit |
b099d7 |
.fi
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
Be certain in reviewing the differences between files that you search for
|
|
Packit |
b099d7 |
signal messages.
|
|
Packit |
b099d7 |
.H 3 "Other Failures"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
Many other kinds of failures only show up by examining the contents of
|
|
Packit |
b099d7 |
the differences file (\*L.err\*O) produced by the RUN script; this differences file is the product of the command \*Ldiff\*O run against the output file stored at record time and the output file for the current run. This section
|
|
Packit |
b099d7 |
describes some examples of what differences might turn up; very subtle bugs
|
|
Packit |
b099d7 |
may make their appearance known only through small differences in the output.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
.BL
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
Messages printed by callback routines can indicate more or fewer callbacks are occurring on some action.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
Differences in size reported by callback routines may show layout differences
|
|
Packit |
b099d7 |
not captured by CompareVisual, usually because the top-level manager is not photographed.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
User data printed out may indicate a test was run in the wrong mode.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
CompareVisual failure messages will turn up in diffs.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
Running a non-automated \*Lmwm\*O can produce window command failures which show up as differences. This may precipitate CompareVisual failures further along in the test.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
Key-binding error messages may appear in diffs if the \fBqauser\*O environment
|
|
Packit |
b099d7 |
in not used.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
\*LxisMovePointer\*O errors may mean that layout has changed, and the pointer can
|
|
Packit |
b099d7 |
no longer move to a certain widget.
|
|
Packit |
b099d7 |
.LI
|
|
Packit |
b099d7 |
If tests are run in interactive mode, "Accept" messages will appear in diffs
|
|
Packit |
b099d7 |
but can be ignored.
|
|
Packit |
b099d7 |
.LE
|
|
Packit |
b099d7 |
.H 2 "Debugging Tricks and Testing Strategies"
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
This section will describe several automation features which can be used
|
|
Packit |
b099d7 |
to help debug test failures. While nothing is as good as first-hand
|
|
Packit |
b099d7 |
experience, this section will give you some idea of the tools at your
|
|
Packit |
b099d7 |
disposal.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
Generally, one will wish to run the entire test suite automatically then
|
|
Packit |
b099d7 |
debug the failures one at a time. If the failures appear to be due (in whole
|
|
Packit |
b099d7 |
or in part) to visual differences, it often makes the most sense to run
|
|
Packit |
b099d7 |
the offending test in interactive mode. The various overlay capabilities of
|
|
Packit |
b099d7 |
interactive mode have been described earlier. This is the quickest way to
|
|
Packit |
b099d7 |
assess the nature of the change; once you know what the difference is you
|
|
Packit |
b099d7 |
can debug the cause. However, there are other modes and features which
|
|
Packit |
b099d7 |
can be used.
|
|
Packit |
b099d7 |
.H 3 "The \*L-a\*O Flag"
|
|
Packit |
b099d7 |
The precursor to the interactive window was the \*L-a\*O flag. When run
|
|
Packit |
b099d7 |
with this flag, tests print out the x,y location of each pixel that differs
|
|
Packit |
b099d7 |
from the original. If the differences are really a single or two pixels and
|
|
Packit |
b099d7 |
you have difficulty seeing the differences in interactive mode, the information provided by \*L-a\*O may be helpful.
|
|
Packit |
b099d7 |
.H 3 "Window Dumps"
|
|
Packit |
b099d7 |
Another visual debugging tool which predates the interactive mode window
|
|
Packit |
b099d7 |
is the window dump feature. Tests run with the
|
|
Packit |
b099d7 |
\*L-W\*O flag create xwd-format window dumps which can subsequently be
|
|
Packit |
b099d7 |
viewed with the \*Lxwud\*O client. Your company may have other tools that
|
|
Packit |
b099d7 |
use xwd-format images; if so, this option may be useful for you.
|
|
Packit |
b099d7 |
.H 3 "The \*LManual\*O Command"
|
|
Packit |
b099d7 |
For certain problems, you will need to be able to manipulate the widgets in
|
|
Packit |
b099d7 |
the test client directly. Because automation takes control of the pointer,
|
|
Packit |
b099d7 |
we have provided a scripting language command \*LManual\*O which tells
|
|
Packit |
b099d7 |
the automation code to suspend its normal event handling and return control
|
|
Packit |
b099d7 |
to the user, until the user clicks the Continue button on the
|
|
Packit |
b099d7 |
Manual mode DialogBox. At that point the
|
|
Packit |
b099d7 |
test will resume. This gives you an opportunity to examine closely what
|
|
Packit |
b099d7 |
happens at very specific points during the test.
|
|
Packit |
b099d7 |
.P
|
|
Packit |
b099d7 |
To use \*LManual\*O, simply add the command at the appropriate point in
|
|
Packit |
b099d7 |
the test's \*L.scr\*O file and remake the \*L.Scr\*O file. When the
|
|
Packit |
b099d7 |
Manual command is reached, a special dialog box will appear and you may
|
|
Packit |
b099d7 |
exercise the test client normally. At this point, you can also invoke
|
|
Packit |
b099d7 |
other useful X debugging clients, such as \*Lxmag\*O, \*Lxwininfo\*O,
|
|
Packit |
b099d7 |
or the OSF/Motif test tool \*Lxmruler\*O.
|
|
Packit |
b099d7 |
.H 3 "Delay Mode"
|
|
Packit |
b099d7 |
If you need the playback slowed enough for a human tester to watch the
|
|
Packit |
b099d7 |
changes occurring, but don't actually require the suspension of the event
|
|
Packit |
b099d7 |
loop provided by \*LManual\*O, the \*L-D\*O or \*LDelay\*O mode
|
|
Packit |
b099d7 |
might be helpful. Run with \*L-D \*Vseconds\*O, the code "sleeps" for the
|
|
Packit |
b099d7 |
requested number of seconds before executing the next instruction.
|
|
Packit |
b099d7 |
The Delay flag can also be used when very fast workstations execute
|
|
Packit |
b099d7 |
instructions before the visuals have "caught up".
|
|
Packit |
b099d7 |
.H 3 "Trace Mode"
|
|
Packit |
b099d7 |
The \*L-T\*O or \*LTrace\*O mode is useful in many debugging situations.
|
|
Packit |
b099d7 |
In Trace mode, the scripting instructions are echoed to the output file
|
|
Packit |
b099d7 |
as they are executed. This greatly simplies, for instance, the process of
|
|
Packit |
b099d7 |
determining which button produces an extra Activate callback. It may be
|
|
Packit |
b099d7 |
worth considering using the Trace mode by default for all recording and
|
|
Packit |
b099d7 |
playback. This can also help determine cases where failures are merely the
|
|
Packit |
b099d7 |
result of recorded output files getting out-of-sync with the tests or scripts
|
|
Packit |
b099d7 |
currently executing.
|
|
Packit |
b099d7 |
.H 3 "The \*Lxmruler\*O Tool"
|
|
Packit |
b099d7 |
The tool \*Lxmruler\*O is provided in the directory \*L$TOP/tests/tools\*O.
|
|
Packit |
b099d7 |
This client allows the user to "measure" widgets on screen which claim to
|
|
Packit |
b099d7 |
be a certain size.
|
|
Packit |
b099d7 |
|
|
Packit |
b099d7 |
|