Menu

#67 Have UnitTestCase automatically call tally() on all mocks

closed
nobody
5
2009-11-11
2009-11-11
No

Given that mock objects are a part of the unit testing framework, it seems odd that I have to remember to tally() my mocks at the end of each unit test. Mock::generate() should create constructors that register the mock with the unit test runner so that it can call tally() on them at the end of the test. Leaving it up to the user opens the door for many "false passes."

Discussion

  • daniel hahler

    daniel hahler - 2009-11-11

    I think this is not relevant with simpletest trunk (in SVN) anymore, but I might be wrong.
    However, I'm not calling tally() since a long time - and the method has been probably removed someday completely.
    Have you checked this with trunk/SVN?

     
  • David Harkness

    David Harkness - 2009-11-11

    You are correct, even in the release version I am using tally() is being called automatically. I didn't think it was because I had a test that was calling a method that I hadn't set an expectation for (see the other bug I just posted), and the test was passing. I assumed it was because I forgot to add tally() which I added at the same time that I added the expectOnce() call.

     
  • David Harkness

    David Harkness - 2009-11-11
    • labels: --> Unit test framework
    • status: open --> closed
     

Log in to post a comment.