2
0
mirror of https://github.com/boostorg/test.git synced 2026-02-19 14:52:09 +00:00
Files
test/doc/v2/html/boost_test/fixtures/generic_fixture_model.html
Raffi Enficiaud a207f85aaf faq
2014-01-27 14:31:55 +01:00

73 lines
4.9 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Generic fixture model</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="../fixtures.html" title="Fixtures... or let me repeat myself">
<link rel="prev" href="../fixtures.html" title="Fixtures... or let me repeat myself">
<link rel="next" href="fixture_per_test_cases.html" title="Per test case fixture">
</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="../fixtures.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../fixtures.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="fixture_per_test_cases.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.fixtures.generic_fixture_model"></a><a name="fixtures_generic"></a><a class="link" href="generic_fixture_model.html" title="Generic fixture model">Generic
fixture model</a>
</h3></div></div></div>
<p>
The <span class="emphasis"><em>UTF</em></span> defines the generic fixture model as follows:
</p>
<pre class="programlisting"><span class="keyword">struct</span> <span class="special">&lt;</span><span class="identifier">fixture</span><span class="special">-</span><span class="identifier">name</span><span class="special">&gt;{</span>
<span class="special">&lt;</span><span class="identifier">fixture</span><span class="special">-</span><span class="identifier">name</span><span class="special">&gt;();</span> <span class="comment">// setup function</span>
<span class="special">~&lt;</span><span class="identifier">fixture</span><span class="special">-</span><span class="identifier">name</span><span class="special">&gt;();</span> <span class="comment">// teardown function</span>
<span class="special">};</span>
</pre>
<p>
In other words a fixture is expected to be implemented as a class where the
class constructor serves as a setup method and class destructor serves as
teardown method. The <span class="emphasis"><em>UTF</em></span> opted to avoid explicit names
in fixture interface for setup and teardown methods, since is considered
most natural in C++ for tasks similar to RAII and coincides with the pure
C++ solution discusses earlier.
</p>
<div class="caution"><table border="0" summary="Caution">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Caution]" src="../../../../../../../doc/src/images/caution.png"></td>
<th align="left">Caution</th>
</tr>
<tr><td align="left" valign="top"><p>
The above interface prevents you to report errors in the teardown procedure
using an exception. It does make sense though: if somehow more than one
fixture is assigned to a test unit, you want all teardown procedures to
run, even if some may experience problems.
</p></td></tr>
</table></div>
</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-2013 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="../fixtures.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../fixtures.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="fixture_per_test_cases.html"><img src="../../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>