A nice little feature I’ve just added to my single header C/C++ unit testing library utest.h is the ability to skip a test case. The motivation for this feature is from a user request, and it makes sense in the context that sometimes you might be refactoring some code, or designing a new feature, and the tests aren’t quite ready yet. You don’t want to comment out or delete the code, so what do you do?

To support this I’ve submitted a PR that adds a UTEST_SKIP, which can be used like:

UTEST(foo, bar) {
  UTEST_SKIP("Need to implement this test!");

To let you skip the remainder of the test. Then when executing the test will output:

[ RUN      ] foo.bar
   Skipped : 'Need to implement this test!'
[  SKIPPED ] foo.bar (39ns)

And also reports at the end of execution before any failing tests:

[==========] 860 test cases ran.
[  PASSED  ] 859 tests.
[  SKIPPED ] 1 tests, listed below:
[  SKIPPED ] foo.bar

As a reminder you can get my library at https://github.com/sheredom/utest.h, it works with mixed C/C++ content, and is blazingly fast.