~ubuntu-branches/ubuntu/dapper/dejagnu/dapper

« back to all changes in this revision

Viewing changes to doc/html/x1445.html

  • Committer: Bazaar Package Importer
  • Author(s): Daniel Jacobowitz
  • Date: 2004-02-09 15:07:58 UTC
  • Revision ID: james.westby@ubuntu.com-20040209150758-oaj7r5zrop60v8sb
Tags: upstream-1.4.4
ImportĀ upstreamĀ versionĀ 1.4.4

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
 
2
<HTML
 
3
><HEAD
 
4
><TITLE
 
5
>Writing A Test Case</TITLE
 
6
><META
 
7
NAME="GENERATOR"
 
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
 
9
"><LINK
 
10
REL="HOME"
 
11
TITLE="DejaGnu"
 
12
HREF="book1.html"><LINK
 
13
REL="UP"
 
14
TITLE="Extending DejaGnu"
 
15
HREF="c1099.html"><LINK
 
16
REL="PREVIOUS"
 
17
TITLE="Board Config File Values"
 
18
HREF="x1234.html"><LINK
 
19
REL="NEXT"
 
20
TITLE="Debugging A Test Case"
 
21
HREF="x1462.html"></HEAD
 
22
><BODY
 
23
CLASS="SECT1"
 
24
BGCOLOR="#FFFFFF"
 
25
TEXT="#000000"
 
26
LINK="#0000FF"
 
27
VLINK="#840084"
 
28
ALINK="#0000FF"
 
29
><DIV
 
30
CLASS="NAVHEADER"
 
31
><TABLE
 
32
SUMMARY="Header navigation table"
 
33
WIDTH="100%"
 
34
BORDER="0"
 
35
CELLPADDING="0"
 
36
CELLSPACING="0"
 
37
><TR
 
38
><TH
 
39
COLSPAN="3"
 
40
ALIGN="center"
 
41
>DejaGnu: The GNU Testing Framework</TH
 
42
></TR
 
43
><TR
 
44
><TD
 
45
WIDTH="10%"
 
46
ALIGN="left"
 
47
VALIGN="bottom"
 
48
><A
 
49
HREF="x1234.html"
 
50
ACCESSKEY="P"
 
51
>&#60;&#60;&#60; Previous</A
 
52
></TD
 
53
><TD
 
54
WIDTH="80%"
 
55
ALIGN="center"
 
56
VALIGN="bottom"
 
57
>Extending DejaGnu</TD
 
58
><TD
 
59
WIDTH="10%"
 
60
ALIGN="right"
 
61
VALIGN="bottom"
 
62
><A
 
63
HREF="x1462.html"
 
64
ACCESSKEY="N"
 
65
>Next &#62;&#62;&#62;</A
 
66
></TD
 
67
></TR
 
68
></TABLE
 
69
><HR
 
70
ALIGN="LEFT"
 
71
WIDTH="100%"></DIV
 
72
><DIV
 
73
CLASS="SECT1"
 
74
><H1
 
75
CLASS="SECT1"
 
76
><A
 
77
NAME="WRITING"
 
78
></A
 
79
>Writing A Test Case</H1
 
80
><P
 
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
 
85
><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
 
95
      module <TT
 
96
CLASS="FILENAME"
 
97
>lib/c-torture.exp</TT
 
98
> in the GCC test
 
99
      suite. Most tests of this kind use very few
 
100
      <SPAN
 
101
CLASS="PRODUCTNAME"
 
102
>expect</SPAN
 
103
> features, and are coded almost
 
104
      purely in Tcl.</P
 
105
><P
 
106
>Writing the complete suite of C tests, then, consisted of
 
107
      these steps:</P
 
108
><P
 
109
></P
 
110
><UL
 
111
><LI
 
112
STYLE="list-style-type: disc"
 
113
><P
 
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
 
117
      development.</P
 
118
></LI
 
119
><LI
 
120
STYLE="list-style-type: disc"
 
121
><P
 
122
>Writing (and debugging) the generic Tcl procedures for
 
123
      compilation.</P
 
124
></LI
 
125
><LI
 
126
STYLE="list-style-type: disc"
 
127
><P
 
128
>Writing the simple test driver: its main task is to
 
129
      search the directory (using the Tcl procedure
 
130
      <I
 
131
CLASS="EMPHASIS"
 
132
>glob</I
 
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
 
136
></LI
 
137
></UL
 
138
><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
 
142
><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
 
152
      testing.</P
 
153
></DIV
 
154
><DIV
 
155
CLASS="NAVFOOTER"
 
156
><HR
 
157
ALIGN="LEFT"
 
158
WIDTH="100%"><TABLE
 
159
SUMMARY="Footer navigation table"
 
160
WIDTH="100%"
 
161
BORDER="0"
 
162
CELLPADDING="0"
 
163
CELLSPACING="0"
 
164
><TR
 
165
><TD
 
166
WIDTH="33%"
 
167
ALIGN="left"
 
168
VALIGN="top"
 
169
><A
 
170
HREF="x1234.html"
 
171
ACCESSKEY="P"
 
172
>&#60;&#60;&#60; Previous</A
 
173
></TD
 
174
><TD
 
175
WIDTH="34%"
 
176
ALIGN="center"
 
177
VALIGN="top"
 
178
><A
 
179
HREF="book1.html"
 
180
ACCESSKEY="H"
 
181
>Home</A
 
182
></TD
 
183
><TD
 
184
WIDTH="33%"
 
185
ALIGN="right"
 
186
VALIGN="top"
 
187
><A
 
188
HREF="x1462.html"
 
189
ACCESSKEY="N"
 
190
>Next &#62;&#62;&#62;</A
 
191
></TD
 
192
></TR
 
193
><TR
 
194
><TD
 
195
WIDTH="33%"
 
196
ALIGN="left"
 
197
VALIGN="top"
 
198
>Board Config File Values</TD
 
199
><TD
 
200
WIDTH="34%"
 
201
ALIGN="center"
 
202
VALIGN="top"
 
203
><A
 
204
HREF="c1099.html"
 
205
ACCESSKEY="U"
 
206
>Up</A
 
207
></TD
 
208
><TD
 
209
WIDTH="33%"
 
210
ALIGN="right"
 
211
VALIGN="top"
 
212
>Debugging A Test Case</TD
 
213
></TR
 
214
></TABLE
 
215
></DIV
 
216
></BODY
 
217
></HTML
 
218
>
 
 
b'\\ No newline at end of file'