Home > The Unit Test Framework > Introduction


The acceptance test makes the customer satisfied that the software provides the business value that makes them willing to pay for it. The unit test makes the programmer satisfied that the software does what the programmer thinks it does

--XP maxim

What is the first thing you need to do when you start working on new library/class/program? That's right - you need to start with the unit test module (I hope you all gave this answer!). Occasional, simple test may be implemented using asserts. But any professional developer soon finds this approach lacking. It becomes clear that it's too time-consuming and tedious for simple, but repetitive unit testing tasks and it's too inflexible for most nontrivial ones.

The Boost Test Library Unit Test Framework (further in the documentation referred by the acronym UTF) provides both an easy to use and flexible solution to this problem domain: C++ unit test implementation and organization.

Unit testing tasks arise during many different stages of software development: from initial project implementation to its maintenance and later revisions. These tasks differ in their complexity and purpose and accordingly are approached differently by different developers. The wide spectrum of tasks in a problem domain cause many requirements (sometimes conflicting) to be placed on a unit testing framework. These include:

The UTF design is based on above rationale and provides versatile facilities to:

The UTF keeps track of all passed/failed testing tools assertions, provides an ability to check the test progress and generates a result report in several different formats. The UTF supplies command line test runners that initialize the framework and run the requested tests. Depending on the selected compilation flags the function main() default implementation, that invoke the supplied test runner, can be generated automatically as well.

The UTF is intended to be used both for a simple and non trivial testing. It is not intended to be used with production code. In this case the Program Execution Monitor is more suitable.

Given the largely differing requirements of new and advanced users, it is clear that the UTF must provide both simple, easy-to-use interfaces with limited customization options and advanced interfaces, which allow unit testing to be fully customized. Accordingly the material provided in this documentation is split into two sections:

For those interested in getting started quickly please visit collection of examples presented in this documentation.