test_module_runner_overview.html 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
  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. <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>
  63. <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>
  64. <span class="special">}</span> <span class="special">}</span>
  65. </pre>
  66. <p>
  67. The test runner may return one of the following values:
  68. </p>
  69. <div class="informaltable"><table class="table">
  70. <colgroup>
  71. <col>
  72. <col>
  73. </colgroup>
  74. <thead><tr>
  75. <th>
  76. <p>
  77. Value
  78. </p>
  79. </th>
  80. <th>
  81. <p>
  82. Meaning
  83. </p>
  84. </th>
  85. </tr></thead>
  86. <tbody>
  87. <tr>
  88. <td>
  89. <p>
  90. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_success</span></code>
  91. </p>
  92. </td>
  93. <td>
  94. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  95. <li class="listitem">
  96. No errors occurred during testing, or
  97. </li>
  98. <li class="listitem">
  99. the success result was forced with command-line argument <code class="computeroutput"><span class="special">--[</span><span class="identifier">link</span>
  100. <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>.
  101. </li>
  102. </ul></div>
  103. </td>
  104. </tr>
  105. <tr>
  106. <td>
  107. <p>
  108. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_test_failure</span></code>
  109. </p>
  110. </td>
  111. <td>
  112. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  113. <li class="listitem">
  114. Non-fatal errors detected and no uncaught exceptions were thrown
  115. during testing, or
  116. </li>
  117. <li class="listitem">
  118. the initialization of the <span class="emphasis"><em>Unit Test Framework</em></span>
  119. failed.
  120. </li>
  121. </ul></div>
  122. </td>
  123. </tr>
  124. <tr>
  125. <td>
  126. <p>
  127. <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">exit_exception_failure</span></code>
  128. </p>
  129. </td>
  130. <td>
  131. <div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
  132. <li class="listitem">
  133. Fatal errors were detected, or
  134. </li>
  135. <li class="listitem">
  136. uncaught exceptions thrown during testing.
  137. </li>
  138. </ul></div>
  139. </td>
  140. </tr>
  141. </tbody>
  142. </table></div>
  143. <p>
  144. An advanced test runner may provide additional features, including interactive
  145. GUI interfaces, test coverage and profiling support.
  146. </p>
  147. </div>
  148. <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
  149. <td align="left"></td>
  150. <td align="right"><div class="copyright-footer">Copyright &#169; 2001-2019 Boost.Test
  151. contributors<p>
  152. Distributed under the Boost Software License, Version 1.0. (See accompanying
  153. 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>)
  154. </p>
  155. </div></td>
  156. </tr></table>
  157. <hr>
  158. <div class="spirit-nav">
  159. <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>
  160. </div>
  161. </body>
  162. </html>