mirror of
https://github.com/boostorg/test.git
synced 2026-02-02 21:22:10 +00:00
105 lines
5.9 KiB
HTML
Executable File
105 lines
5.9 KiB
HTML
Executable File
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
<title>Test progress display</title>
|
||
<link rel="stylesheet" href="../../../../style/style.css" type="text/css">
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
|
||
<link rel="home" href="../../../index.html" title="Boost Test Library">
|
||
<link rel="up" href="../test-output.html" title="Test Output or let's see what you got for your money">
|
||
<link rel="prev" href="results-report.html" title="Test report output">
|
||
<link rel="next" href="../runtime-config.html" title="Runtime configuration or what are the strings I can pull?">
|
||
<script language="JavaScript1.2" src="../../../../js/boost-test.js"></script>
|
||
</head>
|
||
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
|
||
<table width="100%"><tr>
|
||
<td width="10%"><a href="../../../index.html"><img alt="Home" width="229" height="61" border="0" src="../../../../../../../libs/test/docbook/img/boost.test.logo.png"></a></td>
|
||
<td valign="middle" align="left"> > <a href="../../../utf.html">The Unit Test Framework</a> > <a href="../../user-guide.html">User's guide</a><a href="../../testing-tools.html">
|
||
>
|
||
</a><a href="../test-output.html">Test Output </a><a href="../runtime-config.html">
|
||
>
|
||
</a><b>Progress display</b>
|
||
</td>
|
||
<td><div class="spirit-nav">
|
||
<a href="results-report.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a href="../runtime-config.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||
</div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="section" lang="en">
|
||
<div class="titlepage"><div><div><h5 class="title">
|
||
<a name="utf.user-guide.test-output.progress"></a>Test progress display</h5></div></div></div>
|
||
<p class="first-line-indented">
|
||
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 <acronym class="acronym">UTF</acronym> support simple text progress display, implemented based
|
||
on <code class="computeroutput">boost::progress_display</code><sup>[<a name="id655789" href="#ftn.id655789" class="footnote">5</a>]</sup>. The progress display output
|
||
is enabled using the <acronym class="acronym">UTF</acronym> parameter <a class="link" href="../runtime-config/reference.html#utf.user-guide.runtime-config.parameters">show_progress</a>.
|
||
</p>
|
||
<p class="first-line-indented">
|
||
The <acronym class="acronym">UTF</acronym> 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 <acronym class="acronym">UTF</acronym> 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 class="first-line-indented">
|
||
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">boost::unit_test::progress_monitor.set_stream( std::ostream& )</pre>
|
||
<div class="example">
|
||
<a name="utf.user-guide.test-output.progress.example49"></a><p class="title"><b>Example 33. Progress report for the test module with large amount of test cases</b></p>
|
||
<div class="example-contents">
|
||
<pre class="programlisting">#include <boost/test/included/unit_test.hpp>
|
||
using namespace boost::unit_test;
|
||
|
||
//____________________________________________________________________________//
|
||
|
||
void free_test_function()
|
||
{
|
||
BOOST_CHECK( true /* test assertion */ );
|
||
}
|
||
|
||
//____________________________________________________________________________//
|
||
|
||
test_suite*
|
||
init_unit_test_suite( int argc, char* argv[] )
|
||
{
|
||
for( int i=0; i < 10000; i++ )
|
||
framework::master_test_suite().
|
||
add( BOOST_TEST_CASE( &free_test_function ) );
|
||
|
||
return 0;
|
||
}
|
||
|
||
//____________________________________________________________________________//
|
||
</pre>
|
||
<table class="simplelist" border="0" summary="Simple list"><tr>
|
||
<td><code class="literal"><a href="../../../../src/examples/example49.cpp" target="_top">Source code</a></code></td>
|
||
<td> | </td>
|
||
<td><code class="literal"><a href="#" target="_top" id="id655904" onclick="toggle_element( 'example49-output', 'id655904', 'Show output', 'Hide output' ); return false;">Show output</a></code></td>
|
||
</tr></table>
|
||
<pre class="example-output" id="example49-output">> example --show_progress=yes --log_level=nothing
|
||
|
||
0% 10 20 30 40 50 60 70 80 90 100%
|
||
|----|----|----|----|----|----|----|----|----|----|
|
||
***************************************************
|
||
|
||
*** No errors detected
|
||
</pre>
|
||
</div>
|
||
</div>
|
||
<br class="example-break"><div class="footnotes">
|
||
<br><hr width="100" align="left">
|
||
<div class="footnote"><acronym class="acronym"><sup>[<a name="ftn.id655789" href="#id655789" class="acronym">5</a>] </sup>UTF</acronym></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-2007 Gennadiy Rozental</div></td>
|
||
</tr></table>
|
||
<hr>
|
||
<div class="spirit-nav">
|
||
<a accesskey="p" href="results-report.html"><img src="../../../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../test-output.html"><img src="../../../../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../../index.html"><img src="../../../../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="../runtime-config.html"><img src="../../../../../../../doc/html/images/next.png" alt="Next"></a>
|
||
</div>
|
||
</body>
|
||
</html>
|