Carna
Version 3.3.2
|
This namespace contains the test suite components. More...
This namespace contains the test suite components.
The test suite is built upon QTestLib. It is integrated into CMake not via CTest but as an executable. All files belonging to the test suite are listed within test/CMakeLists.txt
. For each class under test there is a test class, that consists of a pair of header and implementation files. The CMake project is set up to build a single executable for the whole test suite.
When executed, the the test suite returns 0
if and only if all tests pass.
Considering test types, the test suite currently differs among unit tests, module tests and integration tests. For each test type there is a dedicated configure.cmake
file.
This is where the test cases are specified:
test/UnitTests/configure.cmake
.test/ModuleTests/configure.cmake
.test/IntegrationTests/configure.cmake
.In order to add a new test, simply choose the proper test type and modify the corresponding configure.cmake
file.
Each consists of the sections below.
TESTS
lists the class names of all test classes. If your class MyClass
was tested by the test class named MyClassTest
, you would have MyClassTest
listed here.TESTS_QOBJECT_HEADERS
lists the header files where the test classes are defined. QTestLib requires each test class to be derived from QObject
.Q_OBJECT
macro, they needed to be listed within TESTS_HEADERS
.APPEND TESTS_SOURCES
lists the test classes implementation files.There are two ways of specifying the test suite's additional files that do not define any test classes. If these files are only required by a certain test type, they should be enlisted within the TESTS_QOBJECT_HEADERS
or TESTS_HEADERS
variable of the corresponding configure.cmake
file, depending on whether they do use the Q_OBJECT
macro or not. The other option is to enlist them within the test/CMakeLists.txt
file, beneath the same variables. This way they become available to each test type.
Documentation generated by Doxygen