[BACK]Return to x50.html CVS log [TXT][DIR] Up to [Development] / ltp-website / howto

File: [Development] / ltp-website / howto / x50.html (download) (as text)

Revision 1.1, Wed Oct 11 15:52:55 2000 UTC (17 years ago) by nstraz
Branch: MAIN
CVS Tags: HEAD

I'm going to start a discussion on the list about the howto and I want to put some exports of the howto out there for people to look at.

<HTML
><HEAD
><TITLE
>  Writing Tests 
 </TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.49"><LINK
REL="HOME"
TITLE="  Linux Test Project HOWTO
 "
HREF="t1.html"><LINK
REL="PREVIOUS"
TITLE="  Structure 
 "
HREF="x45.html"><LINK
REL="NEXT"
TITLE="  Testing Tools
 "
HREF="x59.html"></HEAD
><BODY
CLASS="SECT1"
><DIV
CLASS="NAVHEADER"
><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>Linux Test Project HOWTO</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x45.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x59.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="AEN50"
>Writing Tests</A
></H1
><P
>  Writing a test case is a lot easier than most people think.  Any code that you write to examine how a part of the kernel works can be adapted into a test case.  All that is needed is a way to report the result of the action to the rest of the world.  There are several ways of doing this, some more involved than others. 
 </P
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN53"
>Exit Style Tests</A
></H2
><P
>   Probably the simplest way of reporting the results of a test case is the exit status of your program.  If your test program encounters unexpected or incorrect results, exit the test program with a non-zero exit status, i.e. exit(1). Conversely, if your program completes as expected, return a zero exit status, i.e. exit(0). Any test driver should be able to handle this type of error reporting. If a test program has multiple test cases you won't know which test case failed, but you will know the program that failed. 
  </P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN56"
>Formatted Output Tests</A
></H2
><P
>   The next easiest way of reporting the results is to write the results of each test case to standard output. This allows for the testing results to be more understandable to both the tester and the analysis tools. When the results are written in a standard way, tools can be used to analyze the results. 
  </P
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x45.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="t1.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x59.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Structure</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Testing Tools</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>