catch3
Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.
Clonegit clone https://git.progmasoft.com/catch3
Update CTest autodiscovery documentation
- Commit
9700ee4fc0f90a4dfc99818ed2d78ce1fc06ee8c- Author
- Martin Hořeňovský ·
- Parents
bbda8cd77cd4
Changes
docs/build-systems.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/build-systems.md b/docs/build-systems.md index afd97eee..2873bc62 100644 --- a/docs/build-systems.md +++ b/docs/build-systems.md @@ -129,7 +129,15 @@ The advantage of this approach is that you can always automatically update Catch ### Automatic test registration -If you are also using ctest, `contrib/ParseAndAddCatchTests.cmake` is a CMake script that attempts to parse your test files and automatically register all test cases, using tags as labels. This means that these +We provide 2 CMake scripts that can automatically register Catch-based +tests with CTest, + * `contrib/ParseAndAddCatchTests.cmake` + * `contrib/CatchAddTests.cmake` + +The first is based on parsing the test implementation files, and attempts +to register all `TEST_CASE`s using their tags as labels. This means that +these: + ```cpp TEST_CASE("Test1", "[unit]") { int a = 1; @@ -149,7 +157,14 @@ TEST_CASE("Test3", "[a][b][c]") { REQUIRE(a == b); } ``` -would be registered as 3 tests, `Test1`, `Test2` and `Test3`, and 4 ctest labels would be created, `a`, `b`, `c` and `unit`. +would be registered as 3 tests, `Test1`, `Test2` and `Test3`, +and 4 CTest labels would be created, `a`, `b`, `c` and `unit`. + + +The second is based on parsing the output of a Catch binary given +`--list-test-names-only`. This means that it deals with inactive +(e.g. commented-out) tests better, but requires CMake 3.10 for full +functionality. ### CodeCoverage module (GCOV, LCOV...)