1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
5
>Writing A Test Case</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
12
HREF="book1.html"><LINK
14
TITLE="Extending DejaGnu"
15
HREF="c1099.html"><LINK
17
TITLE="Board Config File Values"
18
HREF="x1234.html"><LINK
20
TITLE="Debugging A Test Case"
21
HREF="x1462.html"></HEAD
32
SUMMARY="Header navigation table"
41
>DejaGnu: The GNU Testing Framework</TH
51
><<< Previous</A
57
>Extending DejaGnu</TD
65
>Next >>></A
79
>Writing A Test Case</H1
81
>The easiest way to prepare a new test case is to base it
82
on an existing one for a similar situation. There are two major
83
categories of tests: batch or interactive. Batch oriented tests
84
are usually easier to write.</P
86
>The GCC tests are a good example of batch oriented tests.
87
All GCC tests consist primarily of a call to a single common
88
procedure, Since all the tests either have no output, or only
89
have a few warning messages when successfully compiled. Any
90
non-warning output is a test failure. All the C code needed is
91
kept in the test directory. The test driver, written in Tcl,
92
need only get a listing of all the C files in the directory, and
93
compile them all using a generic procedure. This procedure and a
94
few others supporting for these tests are kept in the library
97
>lib/c-torture.exp</TT
99
suite. Most tests of this kind use very few
103
> features, and are coded almost
106
>Writing the complete suite of C tests, then, consisted of
112
STYLE="list-style-type: disc"
114
>Copying all the C code into the test directory.
115
These tests were based on the C-torture test created by Torbjorn
116
Granlund (on behalf of the Free Software Foundation) for GCC
120
STYLE="list-style-type: disc"
122
>Writing (and debugging) the generic Tcl procedures for
126
STYLE="list-style-type: disc"
128
>Writing the simple test driver: its main task is to
129
search the directory (using the Tcl procedure
133
> for filename expansion with wildcards)
134
and call a Tcl procedure with each filename. It also checks for
135
a few errors from the testing procedure.</P
139
>Testing interactive programs is intrinsically more
140
complex. Tests for most interactive programs require some trial
141
and error before they are complete.</P
143
>However, some interactive programs can be tested in a
144
simple fashion reminiscent of batch tests. For example, prior
145
to the creation of DejaGnu, the GDB distribution already
146
included a wide-ranging testing procedure. This procedure was
147
very robust, and had already undergone much more debugging and
148
error checking than many recent DejaGnu test cases.
149
Accordingly, the best approach was simply to encapsulate the
150
existing GDB tests, for reporting purposes. Thereafter, new GDB
151
tests built up a family of Tcl procedures specialized for GDB
159
SUMMARY="Footer navigation table"
172
><<< Previous</A
190
>Next >>></A
198
>Board Config File Values</TD
212
>Debugging A Test Case</TD
b'\\ No newline at end of file'