Incidentally, this is why "test first" is more than just a methodology for selling high-priced consultants. At least it lets you see your tests fail and then pass, rather than just pass. Lots of common patterns pass in the presence of incorrect code.
An example that a coworker was complaining to me about recently:
void testFooBarException() {
try {
thisShouldThrowFooBarException()
} catch (FooBarException ignored) {}
}
Can you spot the bug? The test still passes even if thisShouldThrowFooBarException doesn't throw an exception. Oops.I personally avoid this by checking that I can make the test fail when I expect it to fail, by editing some values or commenting something out. But that doesn't scale, that only saves you once.
Something to think about.