Creating Tests Guideline - Pr0curo/thanote GitHub Wiki
The following document explains the test-strategy used by thanote and how to comply with it.
thanote currently uses catch2 for unit testing. It is possible to use TDD for development, even though it is not done yet (personal lack of knowledge).
To use tests write them into a sourcefile (*.cpp, *.c) and put this file in the projectfolder tests
preferbly the filename should look like this <subject>_test.cpp
.
The first include in the test-sourcefile should be <catch2/catch.hpp>. Make sure that in exactly one testfile CATCH_CONFIG_MAIN is defined (usually it is already).
In the CMakeLists.txt
add the file for testing aswell as the source-file that contains the methods, classes etc. you want to test.
you can the build system to build the tests via ninja tests
.
Be aware that travis-ci is runneing the tests aswell, so failed tests will prevent pull requests from being approved.