1<html> 2<head> 3<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 4<title>Design rationale</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="../intro.html" title="Introduction"> 9<link rel="prev" href="../intro.html" title="Introduction"> 10<link rel="next" href="how_to_read.html" title="How to read this documentation"> 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="../intro.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../intro.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="how_to_read.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.intro.design_rationale"></a><a class="link" href="design_rationale.html" title="Design rationale">Design rationale</a> 28</h3></div></div></div> 29<p> 30 Unit testing tasks arise during many different stages of software development: 31 from initial project implementation to its maintenance and later revisions. 32 These tasks differ in their complexity and purpose and accordingly are approached 33 differently by different developers. The wide spectrum of tasks in a problem 34 domain cause many requirements (sometimes conflicting) to be placed on a 35 unit testing framework. These include: 36 </p> 37<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 38<li class="listitem"> 39 Writing a <a class="link" href="../section_glossary.html#ref_test_module">unit test module</a> should 40 be simple and obvious for new users. 41 </li> 42<li class="listitem"> 43 The framework should allow advanced users to perform non-trivial tests. 44 </li> 45<li class="listitem"> 46 Test module should be able to have many small test cases and developer 47 should be able to group them into test suites. 48 </li> 49<li class="listitem"> 50 At the beginning of the development users want to see verbose and descriptive 51 error messages. 52 </li> 53<li class="listitem"> 54 During the regression testing users just want to know if any tests failed. 55 </li> 56<li class="listitem"> 57 For small test modules, their execution time should prevail over compilation 58 time: user don't want to wait a minute to compile a test that takes a 59 second to run. 60 </li> 61<li class="listitem"> 62 For long and complex tests users want to be able to see the testing progress. 63 </li> 64<li class="listitem"> 65 Simplest tests shouldn't require an external library. 66 </li> 67<li class="listitem"> 68 For long term usage users of the <span class="emphasis"><em>Unit Test Framework</em></span> 69 should be able to build it as a standalone library. 70 </li> 71</ul></div> 72<p> 73 The <span class="emphasis"><em>Unit Test Framework</em></span> satisfies the requirements above, 74 and provides versatile facilities to: 75 </p> 76<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 77<li class="listitem"> 78 Easily specify all the expectations in the code being tested. 79 </li> 80<li class="listitem"> 81 Organize these expectations into <a class="link" href="../section_glossary.html#test_case">test cases</a> 82 and <a class="link" href="../section_glossary.html#test_suite">test suites</a>. 83 </li> 84<li class="listitem"> 85 Detect different kinds of errors, failures, time-outs and report them 86 in a uniform customizable way. 87 </li> 88</ul></div> 89<h5> 90<a name="boost_test.intro.design_rationale.h0"></a> 91 <span class="phrase"><a name="boost_test.intro.design_rationale.why_framework"></a></span><a class="link" href="design_rationale.html#boost_test.intro.design_rationale.why_framework">Why 92 do you need a framework?</a> 93 </h5> 94<p> 95 While you can write a testing program yourself from scratch, the framework 96 offers the following benefits: 97 </p> 98<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "> 99<li class="listitem"> 100 You get an error report in a text format. Error reports are uniform and 101 you can easily machine-analyze them. 102 </li> 103<li class="listitem"> 104 Error reporting is separated from the testing code. You can easily change 105 the error report format without affecting the testing code. 106 </li> 107<li class="listitem"> 108 The framework automatically detects exceptions thrown by the tested components 109 and time-outs, and reports them along other errors. 110 </li> 111<li class="listitem"> 112 You can easily filter the test cases, and call only the desired ones. 113 This does not require changing the testing code. 114 </li> 115</ul></div> 116</div> 117<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> 118<td align="left"></td> 119<td align="right"><div class="copyright-footer">Copyright © 2001-2020 Boost.Test contributors<p> 120 Distributed under the Boost Software License, Version 1.0. (See accompanying 121 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>) 122 </p> 123</div></td> 124</tr></table> 125<hr> 126<div class="spirit-nav"> 127<a accesskey="p" href="../intro.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../intro.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="how_to_read.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a> 128</div> 129</body> 130</html> 131