Results 1 to 5 of 5
Sep 16, 2006, 18:06 #1
- Join Date
- Apr 2006
- 0 Post(s)
- 0 Thread(s)
SimpleTest - asserting errors/exceptions
I've been using SimpleTest for unit testing. So far, it's working great.
However, I'm having a problem when I want to make sure an error occurs. I thought that the documentation said assertError should be used, which is what i've been using. However, the case doesn't seem to be counted. That is, if I have 30 test cases, and I add an assertError assertion, there are still 30 test cases, except there is an extra exception displayed.
Also, it seems I can't test for one error per method. It seems to stop after the first exception and moves onto the next test method.
Then I looked at the source and noticed assertError was marked as depricated. There is a similar method down a bit in the file called expectException(), which both sounds like what i want and looks similar to assertError(). So, I tried using that, but got the same results.
I should note that it does fail if an exception does not occur. But the odd thing is, say that one assertion fails. It'll say 31 passes, 1 fails and 10 exceptions. If it does pass, then it says 31 passes, 0 fails and 11 exceptions.
Is this the way it is supposed to work? The way it is displayed, it looks like it doesn't think those exceptions should occur. Also I'd expect them to be counted as passes if they do pass.