|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<sect1 id="testing">
|
|
Packit |
e4b6da |
<sect1info>
|
|
Packit |
e4b6da |
<abstract role="texinfo-node">
|
|
Packit |
e4b6da |
<para>Discussion of correctness-testing</para>
|
|
Packit |
e4b6da |
</abstract>
|
|
Packit |
e4b6da |
</sect1info>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<title>How docbook2X is tested</title>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<indexterm><primary>testing</primary></indexterm>
|
|
Packit |
e4b6da |
<indexterm><primary>correctness</primary></indexterm>
|
|
Packit |
e4b6da |
<indexterm><primary>validation</primary></indexterm>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
The testing of the process of converting from DocBook to man pages, or Texinfo,
|
|
Packit |
e4b6da |
is complicated by the fact
|
|
Packit |
e4b6da |
that a given input (the DocBook document) usually
|
|
Packit |
e4b6da |
does not have one specific, well-defined output.
|
|
Packit |
e4b6da |
Variations on the output are allowed for the result to look “nice”.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
When docbook2X was in the early stages of development,
|
|
Packit |
e4b6da |
the author tested it simply by running some sample DocBook documents
|
|
Packit |
e4b6da |
through it, and visually inspecting the output.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Clearly, this procedure is not scaleable for testing
|
|
Packit |
e4b6da |
a large number of documents.
|
|
Packit |
e4b6da |
In the later 0.8.<replaceable>x</replaceable> versions
|
|
Packit |
e4b6da |
of docbook2X, the testing has been automated
|
|
Packit |
e4b6da |
as much as possible.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
The testing is implemented by
|
|
Packit |
e4b6da |
heuristic checks on the output to see if
|
|
Packit |
e4b6da |
it comprises a “good” man page or Texinfo file.
|
|
Packit |
e4b6da |
These are the checks in particular:
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<orderedlist>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Validation of the Man-XML or Texi-XML output,
|
|
Packit |
e4b6da |
from the first stage, XSLT stylesheets,
|
|
Packit |
e4b6da |
against the XML DTDs defining the formats.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Running &groff_ref; and &makeinfo_ref;
|
|
Packit |
e4b6da |
on the output, and noting any errors
|
|
Packit |
e4b6da |
or warnings from those programs.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<listitem>
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
Other heuristic checks on the output,
|
|
Packit |
e4b6da |
implemented by a Perl script. Here,
|
|
Packit |
e4b6da |
spurious blank lines, uncollapsed whitespace
|
|
Packit |
e4b6da |
in the output that would cause a bad display
|
|
Packit |
e4b6da |
are checked.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
</listitem>
|
|
Packit |
e4b6da |
</orderedlist>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
There are about 8000 test documents,
|
|
Packit |
e4b6da |
mostly <sgmltag class="element">refentry</sgmltag>
|
|
Packit |
e4b6da |
documents, that can be run
|
|
Packit |
e4b6da |
against the current version of docbook2X.
|
|
Packit |
e4b6da |
A few of them have been gathered by the author
|
|
Packit |
e4b6da |
from various sources and test cases from bug reports.
|
|
Packit |
e4b6da |
The majority come from using
|
|
Packit |
e4b6da |
<ulink url="http://www.catb.org/~esr/doclifter/">doclifter</ulink>
|
|
Packit |
e4b6da |
on existing man pages.
|
|
Packit |
e4b6da |
Most pages pass the above tests.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
To run the tests, go to the <filename>test/</filename>
|
|
Packit |
e4b6da |
directory in the docbook2X distribution.
|
|
Packit |
e4b6da |
The command <userinput>make check</userinput> will run
|
|
Packit |
e4b6da |
some tests on a few documents.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
<para>
|
|
Packit |
e4b6da |
For testing using doclifter,
|
|
Packit |
e4b6da |
first generate the DocBook XML sources using doclifter,
|
|
Packit |
e4b6da |
then take a look at the <filename>test/mass/test.pl</filename>
|
|
Packit |
e4b6da |
testing script and run it.
|
|
Packit |
e4b6da |
Note that a small portion of the doclifter pages
|
|
Packit |
e4b6da |
will fail the tests, because they do not satisfy the heuristic
|
|
Packit |
e4b6da |
tests (but are otherwise correct), or, more commonly,
|
|
Packit |
e4b6da |
the source coming from the doclifter heuristic up-conversion
|
|
Packit |
e4b6da |
has errors.
|
|
Packit |
e4b6da |
</para>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
</sect1>
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|
|
Packit |
e4b6da |
|