mirror of
https://github.com/boostorg/test.git
synced 2026-02-02 09:12:10 +00:00
137 lines
9.8 KiB
HTML
137 lines
9.8 KiB
HTML
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
|
|
<title>Test progress display</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="test_output/test_reports.html" title="Test reports">
|
|
<link rel="next" href="bt_minimal_testing.html" title="Minimal testing facility">
|
|
</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="test_output/test_reports.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="bt_minimal_testing.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.test_output_progress"></a><a name="ref_output_progress"></a><a class="link" href="test_output_progress.html" title="Test progress display">Test
|
|
progress display</a>
|
|
</h2></div></div></div>
|
|
<p>
|
|
In case if the test module involves lengthy computation split among multiple
|
|
test cases you may be interested in progress monitor. The test runners supplied
|
|
with the <span class="emphasis"><em>UTF</em></span> support simple text progress display, implemented
|
|
based on
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">progress_display</span>
|
|
</pre>
|
|
<p>
|
|
<a href="#ftn.boost_test.test_output_progress.f0" class="footnote" name="boost_test.test_output_progress.f0"><sup class="footnote">[9]</sup></a>.
|
|
</p>
|
|
<p>
|
|
The progress display output is enabled using the <span class="emphasis"><em>UTF</em></span> parameter
|
|
<a class="link" href="runtime_parameters_reference/show_progress.html#ref_param_show_progress"><code class="computeroutput"><span class="identifier">show_progress</span></code></a>.
|
|
</p>
|
|
<p>
|
|
The <span class="emphasis"><em>UTF</em></span> has no ability to estimate how long the test case
|
|
execution is going to take and the manual test progress update is not supported
|
|
at this point. The <span class="emphasis"><em>UTF</em></span> tracks the progress on test case
|
|
level. If you want to see more frequent progress update, you need to split
|
|
the test into multiple test cases.
|
|
</p>
|
|
<p>
|
|
In default configuration both test log and test progress outputs are directed
|
|
into standard output stream. Any test log messages are going to interfere with
|
|
test progress display. To prevent this you can either set log level to lower
|
|
level or redirect either test log or test progress output into different stream
|
|
during test module initialization. Use following interface to redirect test
|
|
progress output:
|
|
</p>
|
|
<pre class="programlisting"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">::</span><span class="identifier">progress_monitor</span><span class="special">.</span><span class="identifier">set_stream</span><span class="special">(</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream</span><span class="special">&</span> <span class="special">)</span>
|
|
</pre>
|
|
<div class="table">
|
|
<a name="boost_test.test_output_progress.id_example49"></a><p class="title"><b>Table 61. Progress report for the test module with large amount of test cases</b></p>
|
|
<div class="table-contents"><table class="table" summary="Progress report for the test module with large amount of test cases">
|
|
<colgroup>
|
|
<col>
|
|
<col>
|
|
</colgroup>
|
|
<thead><tr>
|
|
<th>
|
|
<p>
|
|
Code
|
|
</p>
|
|
</th>
|
|
<th>
|
|
<p>
|
|
Output
|
|
</p>
|
|
</th>
|
|
</tr></thead>
|
|
<tbody><tr>
|
|
<td>
|
|
<pre class="programlisting"><span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">included</span><span class="special">/</span><span class="identifier">unit_test</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
|
<span class="keyword">using</span> <span class="keyword">namespace</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">unit_test</span><span class="special">;</span>
|
|
|
|
<span class="keyword">void</span> <span class="identifier">free_test_function</span><span class="special">()</span>
|
|
<span class="special">{</span>
|
|
<span class="identifier">BOOST_CHECK</span><span class="special">(</span> <span class="keyword">true</span> <span class="comment">/* test assertion */</span> <span class="special">);</span>
|
|
<span class="special">}</span>
|
|
|
|
<span class="identifier">test_suite</span><span class="special">*</span> <span class="identifier">init_unit_test_suite</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>
|
|
<span class="special">{</span>
|
|
<span class="keyword">for</span><span class="special">(</span> <span class="keyword">int</span> <span class="identifier">i</span><span class="special">=</span><span class="number">0</span><span class="special">;</span> <span class="identifier">i</span> <span class="special"><</span> <span class="number">10000</span><span class="special">;</span> <span class="identifier">i</span><span class="special">++</span> <span class="special">)</span>
|
|
<span class="identifier">framework</span><span class="special">::</span><span class="identifier">master_test_suite</span><span class="special">().</span>
|
|
<span class="identifier">add</span><span class="special">(</span> <span class="identifier">BOOST_TEST_CASE</span><span class="special">(</span> <span class="special">&</span><span class="identifier">free_test_function</span> <span class="special">)</span> <span class="special">);</span>
|
|
|
|
<span class="keyword">return</span> <span class="number">0</span><span class="special">;</span>
|
|
<span class="special">}</span>
|
|
</pre>
|
|
</td>
|
|
<td>
|
|
<pre class="programlisting"><span class="special">></span> <span class="identifier">example</span> <span class="special">--</span><span class="identifier">show_progress</span><span class="special">=</span><span class="identifier">yes</span> <span class="special">--</span><span class="identifier">log_level</span><span class="special">=</span><span class="identifier">nothing</span>
|
|
|
|
<span class="number">0</span><span class="special">%</span> <span class="number">10</span> <span class="number">20</span> <span class="number">30</span> <span class="number">40</span> <span class="number">50</span> <span class="number">60</span> <span class="number">70</span> <span class="number">80</span> <span class="number">90</span> <span class="number">100</span><span class="special">%</span>
|
|
<span class="special">|----|----|----|----|----|----|----|----|----|----|</span>
|
|
<span class="special">***************************************************</span>
|
|
|
|
<span class="special">***</span> <span class="identifier">No</span> <span class="identifier">errors</span> <span class="identifier">detected</span>
|
|
</pre>
|
|
</td>
|
|
</tr></tbody>
|
|
</table></div>
|
|
</div>
|
|
<br class="table-break"><div class="footnotes">
|
|
<br><hr style="width:100; text-align:left;margin-left: 0">
|
|
<div id="ftn.boost_test.test_output_progress.f0" class="footnote"><p><a href="#boost_test.test_output_progress.f0" class="para"><sup class="para">[9] </sup></a>
|
|
The <span class="emphasis"><em>UTF</em></span> interfaces allow implementing an advanced GUI
|
|
based test runner with arbitrary progress display controls
|
|
</p></div>
|
|
</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 © 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="test_output/test_reports.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="bt_minimal_testing.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
|
|
</div>
|
|
</body>
|
|
</html>
|