Menu

expected fail or incomplete?

2002-05-02
2002-09-01
  • Bob Anderson

    Bob Anderson - 2002-05-02

    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

     
    • Baptiste Lepilleur

      Do you mean that you want a test to fail is there is no assertion done in the test ?

      Baptiste.

       
    • Bob Anderson

      Bob Anderson - 2002-07-31

      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.

       
    • Baptiste Lepilleur

      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.

       
    • Wolfgang Stoecher

      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.

       

Log in to post a comment.