Skip to content

Commit c7a2676

Browse files
committed
Add info about test executor and how to use a custom executor
1 parent 9482b3c commit c7a2676

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

docs/+current/modules/testing/cmake/05_executor.md

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,33 @@ author: RSP Systems A/S
77

88
# Test Executor
99

10-
_TODO: ..._
10+
When tests are registered (_via [ctest's `add_test()`](https://cmake.org/cmake/help/latest/command/add_test.html)_),
11+
a "test executor" (_cmake script_) is requested executed. The executor is then responsible for invoking the actual test
12+
callback, that has been specified via [`define_test()`](./03_test.md#parameters).
13+
In addition, the executor is also responsible for executing eventual
14+
[before and after callbacks](./02_test_case.md#before-after-callbacks), for the test case.
15+
16+
## Location
17+
18+
The executor can be found at:
19+
[`rsp/testing/executor.cmake`](https://github.com/rsps/cmake-scripts/blob/main/cmake/rsp/testing/executor.cmake).
20+
21+
## Custom Executor
22+
23+
To use a custom executor, set the path to your executor via the `RSP_TEST_EXECUTOR_PATH` property.
24+
This _SHOULD_ be done before specifying your test suites.
25+
26+
```cmake
27+
# ...in your /tests/CMakeLists.txt
28+
29+
enable_testing()
30+
31+
project(my_package_tests LANGUAGES NONE)
32+
33+
include("rsp/testing")
34+
35+
# Set path to custom test executor
36+
set(RSP_TEST_EXECUTOR_PATH "../cmake/my_custom_test_executor.cmake")
37+
38+
define_test_suite("unit" DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/unit")
39+
```

0 commit comments

Comments
 (0)