2
0
mirror of https://github.com/boostorg/test.git synced 2026-02-20 15:12:11 +00:00
Files
test/doc/v2/html/boost_test/tests_organization.html
2014-08-20 01:55:21 +02:00

124 lines
7.4 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Registering, generating and organizing the unit tests</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="../index.html" title="Boost.Test">
<link rel="prev" href="users_guide/link_references/link_boost_test_module_macro.html" title="BOOST_TEST_MODULE">
<link rel="next" href="tests_organization/test_cases.html" title="Test cases">
</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="users_guide/link_references/link_boost_test_module_macro.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tests_organization/test_cases.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="boost_test.tests_organization"></a><a class="link" href="tests_organization.html" title="Registering, generating and organizing the unit tests">Registering, generating
and organizing the unit tests</a>
</h2></div></div></div>
<div class="toc"><dl class="toc">
<dt><span class="section"><a href="tests_organization/test_cases.html">Test cases</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="tests_organization/test_cases/test_organization_nullary.html">Nullary
function based test case</a></span></dt>
<dt><span class="section"><a href="tests_organization/test_cases/unary_function_based_test_case.html">Unary
function based test case</a></span></dt>
<dt><span class="section"><a href="tests_organization/test_cases/test_organization_templates.html">Template
test cases</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="tests_organization/test_organization_test_suite.html">Test
suite</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="tests_organization/test_organization_test_suite/master_test_suite.html">Master
Test Suite</a></span></dt>
<dt><span class="section"><a href="tests_organization/test_organization_test_suite/test_suite_expected_failure.html">Expected
failures specification</a></span></dt>
</dl></dd>
<dt><span class="section"><a href="tests_organization/fixtures.html">Fixtures</a></span></dt>
<dd><dl>
<dt><span class="section"><a href="tests_organization/fixtures/generic_fixture_model.html">Generic
fixture model</a></span></dt>
<dt><span class="section"><a href="tests_organization/fixtures/per_test_case_fixture.html">Per
test case fixture</a></span></dt>
<dt><span class="section"><a href="tests_organization/fixtures/test_suite_level_fixture.html">Test
suite level fixture</a></span></dt>
<dt><span class="section"><a href="tests_organization/fixtures/global_fixture.html">Global
fixture</a></span></dt>
</dl></dd>
</dl></div>
<p>
If you look at many legacy test modules, big chance is that it's implemented
as one big test function that consists of a mixture of check and output statements.
Is there anything wrong with it? Yes. There are various disadvantages in single
test function approach:
</p>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
One big function tends to become really difficult to manage if the number
of checks exceeds a reasonable limit (true for any large function). What
is tested and where - who knows?
</li>
<li class="listitem">
Many checks require similar preparations. This results in code repetitions
within the test function.
</li>
<li class="listitem">
If a fatal error or an exception is caused by any checks within the test
function the rest of tests are skipped and there is no way to prevent this.
</li>
<li class="listitem">
No way to perform only checks for a particular subsystem of the tested
unit.
</li>
<li class="listitem">
No summary of how different subsystems of the tested unit performed under
in the test.
</li>
</ul></div>
<p>
The above points should make it clear that it's preferable to split <a class="link" href="section_glossary.html#ref_test_module">test
module</a> into smaller units. These units are <a class="link" href="tests_organization/test_cases.html" title="Test cases">test
cases</a>.
</p>
<p>
To solve test tree creation problem the <span class="emphasis"><em>UTF</em></span> provides facilities
for <a class="link" href="tests_organization/test_organization_test_suite.html" title="Test suite">test
suite</a> creation. In some cases it's desirable to allow some <span class="emphasis"><em>expected</em></span>
failures in test case without failing a test module. To support this request
The <span class="emphasis"><em>UTF</em></span> allows specifying the number of <a class="link" href="tests_organization/test_organization_test_suite/test_suite_expected_failure.html" title="Expected failures specification">expected
failures</a> in a test case.
</p>
<p>
When several tests shares the same set-up (environment, test data preparation,
etc.), the <a class="link" href="tests_organization/fixtures.html" title="Fixtures">fixture</a>
comes into play. In the <span class="emphasis"><em>UTF</em></span>, fixtures can be defined at
the test case or the test suite level.
</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="users_guide/link_references/link_boost_test_module_macro.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.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="tests_organization/test_cases.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>