|
|
Re: Bug report? testSucceeded method called even when a test fails...
|
Posted: Mar 19, 2003 10:42 AM
|
|
> Hello. I created a class that implements the Reporter > interface and gathers and reports statistical data > regarding the number of tests, the number of passing > tests, etc. I have made the discovery that, while > Reporter.testFailed is called when a test fails or throws > an exception (as it should be), the Reporter.testSucceeded > method is also called REGARDLESS of whether the test > actually passed. My test fails by throwing an > SQLException, which inherits from java.lang.Exception, if > that matters. > > I don't know if this is a bug or a design decision (I > suspect it is a bug), but it would probably be a good idea > to avoid calling Reporter.testSucceeded after a test > failure. At any rate, I just thought I should give > everybody a heads-up on this.
Ack. That's a bug. I just looked at the code. It has been in there since we put setUpFixture and tearDownFixture back in, long before the initial public release. What shocks me is that we never noticed it. Of course, I never imagined the problem so I didn't write a test that would detect it. But the evidence was staring me in the face in the output of every single test that ran with a failure, and I still never noticed it.
Thanks for reporting this issue. I'll fix this in the next release. Your interpretation of what makes sense is what I had intended. A test completes with either a testSucceeded or a testFailed report, but never both.
|
|