1
0
mirror of https://github.com/catchorg/Catch2.git synced 2025-05-03 05:23:52 +00:00
Catch2/docs/deprecations.md
Philip Salzmann d548be26e3
Add new SKIP macro for skipping tests at runtime (#2360)
* Add new SKIP macro for skipping tests at runtime

This adds a new `SKIP` macro for dynamically skipping tests at runtime.
The "skipped" status of a test case is treated as a first-class citizen,
like "succeeded" or "failed", and is reported with a new color on the
console.

* Don't show "skipped assertions" in console/compact reporters

Also extend skip tests to cover a few more use cases.

* Return exit code 4 if all test cases are skipped

* Use LightGrey for the skip colour

This isn't great, but is better than the deep blue that was borderline
invisible on dark backgrounds. The fix is to redo the colouring
a bit, including introducing light-blue that is actually visible.

* Add support for explicit skips in all reporters

* --allow-running-no-tests also allows all tests to be skipped

* Add docs for SKIP macro, deprecate IEventListener::skipTest

Co-authored-by: Martin Hořeňovský <martin.horenovsky@gmail.com>
2023-01-12 15:01:47 +01:00

1.7 KiB

Deprecations and incoming changes

This page documents current deprecations and upcoming planned changes inside Catch2. The difference between these is that a deprecated feature will be removed, while a planned change to a feature means that the feature will behave differently, but will still be present. Obviously, either of these is a breaking change, and thus will not happen until at least the next major release.

ParseAndAddCatchTests.cmake

The CMake/CTest integration using ParseAndAddCatchTests.cmake is deprecated, as it can be replaced by Catch.cmake that provides the function catch_discover_tests to get tests directly from a CMake target via the command line interface instead of parsing C++ code with regular expressions.

CATCH_CONFIG_BAZEL_SUPPORT

Catch2 supports writing the Bazel JUnit XML output file when it is aware that is within a bazel testing environment. Originally there was no way to accurately probe the environment for this information so the flag CATCH_CONFIG_BAZEL_SUPPORT was added. This now deprecated. Bazel has now had a change where it will export BAZEL_TEST=1 for purposes like the above. Catch2 will now instead inspect the environment instead of relying on build configuration.

IEventLister::skipTest( TestCaseInfo const& testInfo )

This event (including implementations in derived classes such as ReporterBase) is deprecated and will be removed in the next major release. It is currently invoked for all test cases that are not going to be executed due to the test run being aborted (when using --abort or --abortx). It is however NOT invoked for test cases that are explicitly skipped using the SKIP macro.


Home