2
0
mirror of https://github.com/boostorg/test.git synced 2026-02-14 01:02:13 +00:00
Files
test/doc/v2/html/boost_test/users_guide/module_initialization.html
2014-07-06 16:11:15 +02:00

121 lines
7.6 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Test module initialization</title>
<link rel="stylesheet" href="../../../../../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="../../index.html" title="Boost.Test">
<link rel="up" href="../users_guide.html" title="User's guide">
<link rel="prev" href="usage_variants/extern_test_runner_variant.html" title="The external test runner variant of the UTF">
<link rel="next" href="module_initialization/original_initialization_function.html" title="Original initialization function">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../../boost.png"></td>
<td align="center"><a href="../../../../../../../index.html">Home</a></td>
<td align="center"><a href="../../../../../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../../../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="usage_variants/extern_test_runner_variant.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="module_initialization/original_initialization_function.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="boost_test.users_guide.module_initialization"></a><a class="link" href="module_initialization.html" title="Test module initialization">Test module
initialization</a>
</h3></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="module_initialization/original_initialization_function.html">Original
initialization function</a></span></dt>
<dt><span class="section"><a href="module_initialization/alternative_initialization_funct.html">Alternative
initialization function</a></span></dt>
<dt><span class="section"><a href="module_initialization/initialization_function_signatur.html">Initialization
function signature access</a></span></dt>
<dt><span class="section"><a href="module_initialization/automated_generation.html">Automated
generation</a></span></dt>
</dl></div>
<p>
There are two tasks that you may need to perform before actual testing can
start:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
The test tree needs to be built (unless you are using automated test
units registration).
</li>
<li class="listitem">
Custom <span class="emphasis"><em>test module initialization</em></span> needs to be performed.
This includes initialization of the code under test and custom tune-up
of the <span class="emphasis"><em>UTF</em></span> parameters (for example the test log
or the test results report output streams redirection).
</li>
</ul></div>
<p>
The function dedicated for this purpose is called <span class="emphasis"><em>the test module
initialization function</em></span>. Alternatively you can employ global fixtures,
covered in details, including differences in two approaches, in the <a class="link" href="../tests_organization/fixtures.html" title="Fixtures">fixtures</a> section.
</p>
<p>
The <span class="emphasis"><em>UTF</em></span> requires you to implement the test module initialization
function. The test runner supplied with the static library or single-header
variants of the <span class="emphasis"><em>UTF</em></span> requires the specific function specification.
The test runner supplied with the dynamic library variant of the <span class="emphasis"><em>UTF</em></span>
requires the specific initialization function signature only.
</p>
<div class="warning"><table border="0" summary="Warning">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="../../../../../../../doc/src/images/warning.png"></td>
<th align="left">Warning</th>
</tr>
<tr><td align="left" valign="top"><p>
TO FIX: specific specification
</p></td></tr>
</table></div>
<p>
For many <a class="link" href="../section_glossary.html#ref_test_module">test modules</a> you don't need
to do any custom initialization and test tree construction is automated.
In this case you don't really need the initialization function and the <span class="emphasis"><em>UTF</em></span>
provides a way to automatically generate an empty one for you.
</p>
<p>
Original design of the <span class="emphasis"><em>UTF</em></span> supported the manual test
tree construction only. Later versions introduced the automated registration
of test units. In later versions of the <span class="emphasis"><em>UTF</em></span> the original
initialization function specification became inconvenient and unnecessary
unsafe. So the alternative initialization function specification was introduced.
This change is not backward compatible. The test runners supplied with the
static library and single-header variants of the <span class="emphasis"><em>UTF</em></span>
by default still require original initialization function specification,
but support &lt;link linkend="utf.compilation.flags"&gt;compilation
flags&lt;/link&gt; that switch to the alternative one. The test runner supplied
with dynamic library variant of the <span class="emphasis"><em>UTF</em></span> requires new
specification and doesn't support original one. The plan is to deprecate
the original initialization function specification in one of the future releases
and ultimately to stop supporting it.
</p>
<p>
The initialization function invocation is monitored by the <span class="emphasis"><em>UTF</em></span>
the same way as all the test cases. An unexpected exception or system error
detected during initialization function invocation is treated as initialization
error and is reported as such.
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>
<td align="right"><div class="copyright-footer">Copyright &#169; 2001-2014 Gennadiy
Rozental<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="usage_variants/extern_test_runner_variant.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../users_guide.html"><img src="../../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="module_initialization/original_initialization_function.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>