• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
4<title>Test module runner</title>
5<link rel="stylesheet" href="../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7<link rel="home" href="../../index.html" title="Boost.Test">
8<link rel="up" href="../adv_scenarios.html" title="Advanced Usage Scenarios">
9<link rel="prev" href="test_module_init_overview.html" title="Test module's initialization">
10<link rel="next" href="single_header_customizations.html" title="Header-only variant customizations">
11</head>
12<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13<table cellpadding="2" width="100%"><tr>
14<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15<td align="center"><a href="../../../../../../index.html">Home</a></td>
16<td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19<td align="center"><a href="../../../../../../more/index.htm">More</a></td>
20</tr></table>
21<hr>
22<div class="spirit-nav">
23<a accesskey="p" href="test_module_init_overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adv_scenarios.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="single_header_customizations.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
24</div>
25<div class="section">
26<div class="titlepage"><div><div><h3 class="title">
27<a name="boost_test.adv_scenarios.test_module_runner_overview"></a><a class="link" href="test_module_runner_overview.html" title="Test module runner">Test
28      module runner</a>
29</h3></div></div></div>
30<p>
31        A <span class="emphasis"><em>test module runner</em></span> is an <span class="emphasis"><em>orchestrator</em></span>
32        or a <span class="emphasis"><em>driver</em></span> that, given the test tree, ensures the test
33        tree is initialized, tests are executed and necessary reports generated.
34        It performs the following operations:
35      </p>
36<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
37<li class="listitem">
38            initialize the test module using the supplied <a class="link" href="test_module_init_overview.html" title="Test module's initialization"><span class="emphasis"><em>initialization
39            function</em></span></a>;
40          </li>
41<li class="listitem">
42            select output media for the test log and the test results report;
43          </li>
44<li class="listitem">
45            execute test cases as specified by run-time parameters;
46          </li>
47<li class="listitem">
48            produce the test results report;
49          </li>
50<li class="listitem">
51            generate the appropriate return code.
52          </li>
53</ul></div>
54<p>
55        The <span class="emphasis"><em>Unit Test Framework</em></span> comes with the default test
56        runner. There is no need to call it explicitly. The default generated test
57        module's <a class="link" href="entry_point_overview.html" title="Test module's entry point">entry
58        point</a> invokes the default test runner. The default test runner is
59        declared with the following signature:
60      </p>
61<pre class="programlisting"><span class="keyword">namespace</span> <span class="identifier">boost</span> <span class="special">{</span> <span class="keyword">namespace</span> <span class="identifier">unit_test</span> <span class="special">{</span>
62
63  <span class="keyword">typedef</span> <span class="keyword">bool</span> <span class="special">(*</span><span class="identifier">init_unit_test_func</span><span class="special">)();</span>
64
65  <span class="keyword">int</span> <span class="identifier">unit_test_main</span><span class="special">(</span> <span class="identifier">init_unit_test_func</span> <span class="identifier">init_func</span><span class="special">,</span> <span class="keyword">int</span> <span class="identifier">argc</span><span class="special">,</span> <span class="keyword">char</span><span class="special">*</span> <span class="identifier">argv</span><span class="special">[]</span> <span class="special">);</span>
66
67<span class="special">}</span> <span class="special">}</span>
68</pre>
69<p>
70        The test runner may return one of the following values:
71      </p>
72<div class="informaltable"><table class="table">
73<colgroup>
74<col>
75<col>
76</colgroup>
77<thead><tr>
78<th>
79                <p>
80                  Value
81                </p>
82              </th>
83<th>
84                <p>
85                  Meaning
86                </p>
87              </th>
88</tr></thead>
89<tbody>
90<tr>
91<td>
92                <p>
93                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_success</span></code>
94                </p>
95              </td>
96<td>
97                <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
98<li class="listitem">
99                      No errors occurred during testing, or
100                    </li>
101<li class="listitem">
102                      the success result was forced with command-line argument <code class="computeroutput"><span class="special">--[</span><span class="identifier">link</span>
103                      <span class="identifier">boost_test</span><span class="special">.</span><span class="identifier">utf_reference</span><span class="special">.</span><span class="identifier">rt_param_reference</span><span class="special">.</span><span class="identifier">result_code</span> </code>result_code<code class="computeroutput"><span class="special">]=</span><span class="identifier">no</span></code>.
104                    </li>
105</ul></div>
106              </td>
107</tr>
108<tr>
109<td>
110                <p>
111                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_test_failure</span></code>
112                </p>
113              </td>
114<td>
115                <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
116<li class="listitem">
117                      Non-fatal errors detected and no uncaught exceptions were thrown
118                      during testing, or
119                    </li>
120<li class="listitem">
121                      the initialization of the <span class="emphasis"><em>Unit Test Framework</em></span>
122                      failed.
123                    </li>
124</ul></div>
125              </td>
126</tr>
127<tr>
128<td>
129                <p>
130                  <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_exception_failure</span></code>
131                </p>
132              </td>
133<td>
134                <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
135<li class="listitem">
136                      Fatal errors were detected, or
137                    </li>
138<li class="listitem">
139                      uncaught exceptions thrown during testing.
140                    </li>
141</ul></div>
142              </td>
143</tr>
144</tbody>
145</table></div>
146<p>
147        An advanced test runner may provide additional features, including interactive
148        GUI interfaces, test coverage and profiling support.
149      </p>
150</div>
151<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
152<td align="left"></td>
153<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p>
154        Distributed under the Boost Software License, Version 1.0. (See accompanying
155        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>)
156      </p>
157</div></td>
158</tr></table>
159<hr>
160<div class="spirit-nav">
161<a accesskey="p" href="test_module_init_overview.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../adv_scenarios.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="single_header_customizations.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
162</div>
163</body>
164</html>
165