Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Report skipped tests in CTest output #243

Merged
merged 1 commit into from
Apr 17, 2020
Merged

Report skipped tests in CTest output #243

merged 1 commit into from
Apr 17, 2020

Conversation

cottsay
Copy link
Contributor

@cottsay cottsay commented Apr 17, 2020

When adding a test using ament_add_test, the SKIP_TEST argument results in the --skip-test argument being passed to the test wrapper script run_test.py. The wrapper script then writes a JUnit output describing that the test was skipped, and returns 0.

As far as CTest knows, the test succeeded and shows Passed on the console. However, since we know that the test will be skipped by the wrapper, and we expect the wrapper to return 0 after it writes the JUnit file, we can set a test property that will mark the test as Skipped when the wrapper returns 0.

This way, the JUnit output file is still written, but CTest displays the test as skipped as well.

The SKIP_RETURN_CODE test property is present in CMake 3.0.2, if not earlier.

When adding a test using `ament_add_test`, the `SKIP_TEST` argument
results in the `--skip-test` argument being passed to the test wrapper
script `run_test.py`. The wrapper script then writes a JUnit output
describing that the test was skipped, and returns 0.

As far as CTest knows, the test succeeded and shows `Passed` on the
console. However, since we know that the test will be skipped by the
wrapper, and we expect the wrapper to return 0 after it writes the JUnit
file, we can set a test property that will mark the test as `Skipped`
when the wrapper returns 0.

This way, the JUnit output file is still written, but CTest displays the
test as skipped as well.

Signed-off-by: Scott K Logan <logans@cottsay.net>
@cottsay cottsay added enhancement New feature or request in review Waiting for review (Kanban column) labels Apr 17, 2020
@cottsay cottsay self-assigned this Apr 17, 2020
@cottsay cottsay merged commit c67cdf2 into master Apr 17, 2020
@delete-merged-branch delete-merged-branch bot deleted the skip_test_ctest branch April 17, 2020 20:14
j-rivero pushed a commit that referenced this pull request Apr 27, 2020
When adding a test using `ament_add_test`, the `SKIP_TEST` argument
results in the `--skip-test` argument being passed to the test wrapper
script `run_test.py`. The wrapper script then writes a JUnit output
describing that the test was skipped, and returns 0.

As far as CTest knows, the test succeeded and shows `Passed` on the
console. However, since we know that the test will be skipped by the
wrapper, and we expect the wrapper to return 0 after it writes the JUnit
file, we can set a test property that will mark the test as `Skipped`
when the wrapper returns 0.

This way, the JUnit output file is still written, but CTest displays the
test as skipped as well.

Signed-off-by: Scott K Logan <logans@cottsay.net>
Signed-off-by: Jose Luis Rivero <jrivero@osrfoundation.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request in review Waiting for review (Kanban column)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants