Files
Testing Framework

Testing framework for C++. More...

+ Collaboration diagram for Testing Framework:

Files

file  test.h
 Main include file of C++ unit testing framework.
 

Detailed Description

Testing framework for C++.

Unit tests cover only single functions, classes, and modules of the software. For the implementation of such tests, BASIS includes a copy of the Google Test library (GTest). In order to use this library, simply include the sbia/basis/test.h header file in your unit test implementation. To add a unit test to the build system, use the basis_add_test() CMake command together with the UNITTEST option.

Note
A copy of the Google Test (gtest) library is included with BASIS. See the documentation of Google Test for information on how to write unit tests using this library.

System tests, on the other side, execute the programs of the package with given test input data and compare the output of the programs to the expected results. Therefore, a test driver similar to the one included with the ITK 4 is provided by BASIS. It can be used to either execute a test implemented in C++ directly, or to run any test as external process. This test driver in particular provides a way of comparing an output image written by the test to one or more baseline images. The tolerance of the comparison regarding certain criteria can be set on the command-line of the test driver. Use the basis_add_test_driver() CMake command to add a test driver with built-in C++ tests to the build system, or use the imported sbia.basis.testdriver executable target as the COMMAND argument of the basis_add_test() CMake command. Note that tests for the separate tests built into a test driver created by basis_add_test_driver() have still to be added using basis_add_test().

Note
See the help output of the basistest-driver executable of BASIS for a list of available options to perform image-based regression tests or have a look at the documentation generated from the testdriver.h header file.
basistest-driver --help