I am switching to CppUnit from a home brewed test harness, and one thing I found very useful was the ability to code in a second class of "failure by omission," where I would put in a stub for a test, and have the test rig tell me that there were incomplete tests, or expected failures. You don't want to get desensitized to "real" failures, so putting in a CPPUNIT_ASSERT(0) is not a good idea. How hard would this be to implement?
Bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Inspired by this discussion I extended my macro for automatically inserting a test-function body into the cpp-file (for each test declaration in the header file that is not yet implemented) by inserting now also a failing assertion. (I prefer declaring the test in the header file by hand, and letting do the macro the registration and body automatically.)
I've tried this for several days now, and I like it. If, after declaring a test, I find out I should do something else before (like defining a new class), the failing assertion reminds me of completing the test.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I am switching to CppUnit from a home brewed test harness, and one thing I found very useful was the ability to code in a second class of "failure by omission," where I would put in a stub for a test, and have the test rig tell me that there were incomplete tests, or expected failures. You don't want to get desensitized to "real" failures, so putting in a CPPUNIT_ASSERT(0) is not a good idea. How hard would this be to implement?
Bob
Do you mean that you want a test to fail is there is no assertion done in the test ?
Baptiste.
To simplify, let's say there is no assertion. Which is a failure of a different kind, in a sense. The test failed because there is no test yet.
I don't consider this a failure. I quite often write tests that make no assertion. I'm just checking that they do not throw any unexpected exceptions.
Baptiste.
Inspired by this discussion I extended my macro for automatically inserting a test-function body into the cpp-file (for each test declaration in the header file that is not yet implemented) by inserting now also a failing assertion. (I prefer declaring the test in the header file by hand, and letting do the macro the registration and body automatically.)
I've tried this for several days now, and I like it. If, after declaring a test, I find out I should do something else before (like defining a new class), the failing assertion reminds me of completing the test.