boostorg / boostorg/test

Feature Request: Add ability to skip test cases being inside them

Open
#139 17 comments 0 reactions 1 assignee Claimed by @raffienficiaud View on GitHub
feature-request
Dominant language
C++
Stars
213
Forks
149
Avg merge
18h 17m
Merged PRs (30d)
2

Description

Hi!

I want to use something similar to skip() method in python unittest: https://docs.python.org/2/library/unittest.html#skipping-tests-and-expected-failures .
The goal is to check at runtime whether this test case should be run (or should be ignored in the results) or not. For example, if some condition is true we can do BOOST_SKIP("There is no enough free disk space on your computer") and this test case will not be counted as "failed". Instead, probably there can be another column "skipped" which can collect statistics about skipped test cases.

Plan B (the simplest workaround): Is to allow to add expected_failure decorator to a test, being inside the test. For example, in this case we can do something like:
```
if (...) {
current_test_case()->add_decorator(*expected_failures(1));
BOOST_FAIL("There is no enough free disk space on your computer");
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.