Skip to content

Commit 9482b3c

Browse files
committed
Add "quick" guide for how to execute tests
1 parent b82952b commit 9482b3c

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

docs/+current/modules/testing/cmake/04_run_tests.md

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

88
# Run Tests
99

10-
_TODO: ..._
10+
To run test tests, you must first ensure that you build your CMake project. Once you have done so, use the
11+
[ctest executable](https://cmake.org/cmake/help/latest/manual/ctest.1.html) to execute the tests.
12+
13+
```sh
14+
ctest --output-on-failure --test-dir <your-build-directory>/tests
15+
```
16+
17+
## Run Specific Tests
18+
19+
To run only certain tests, use the `--label-regex` option.
20+
21+
```sh
22+
ctest --output-on-failure \
23+
--label-regex "unit" \
24+
--test-dir <your-build-directory>/tests
25+
```
26+
27+
For additional information, see "labels" section in [test suites](./01_test_suite.md#labels) and
28+
[test cases](./02_test_case.md#labels).
29+
30+
## Run Parallel
31+
32+
To run tests in parallel, use the `--parallel` option.
33+
34+
```sh
35+
ctest --output-on-failure --parallel --test-dir <your-build-directory>/tests
36+
```
37+
38+
## Run Failed
39+
40+
To (re)run tests that have failed, use the `--rerun-failed` option.
41+
42+
```sh
43+
ctest --rerun-failed --test-dir <your-build-directory>/tests
44+
```
45+
46+
## Onward
47+
48+
For additional command line arguments and options, please review the official documentation for the
49+
[ctest executable]().

0 commit comments

Comments
 (0)