cmake-examples/05-unit-testing
2020-01-17 19:48:14 -05:00
..
boost Update to minimum CMake 3.5 2018-03-18 17:23:57 +00:00
catch2-vendored spelling fixes 2020-01-17 19:48:14 -05:00
google-test-download Update to minimum CMake 3.5 2018-03-18 17:23:57 +00:00
README.adoc Update unit testing examples to use catch2 2019-01-08 00:11:06 +08:00

= Unit Testing

:toc:
:toc-placement!:

toc::[]

[[intro]]
Introduction
------------

Unit testing is a software development process in which the smallest testable parts of an
application, called units, are individually and independently scrutinized
for proper operation. This can involve taking a class, function, or algorithm
and writing test cases that can be run to verify that the unit is working correctly.

CMake includes a tool called link:https://cmake.org/Wiki/CMake/Testing_With_CTest[CTest]
which allows you to enable the `make test` target to run automated tests such as unit tests.

There are many unit-testing frameworks available which can be used to help automate
and ease the development of unit tests. In these examples I show how to use
some of these frameworks and call them using the CMake testing utility CTest.

The examples here include using the following frameworks:

* http://www.boost.org/doc/libs/1_56_0/libs/test/doc/html/utf/user-guide.html[Boost Unit Test Framework]
* https://github.com/google/googletest[Google Test - Download]
* https://github.com/catchorg/Catch2[Catch2]