I don't think the do...except will work in that case, though the testcase might fail, it doesn't return an exception back to main(). I'd use GetTestsFailedCount() to see if a test has failed, you should be able to accomplish the same thing with that.
No, I believe it's impossible. Any exception thrown within a testcase is dealt with in the TestcaseExit function.
I don't know if it' possible to alter TestcaseExit so it doesn't deal with exceptions, so the testplan would have to deal with them; but I wouldn't like to try it.
That's correct, you need to write your own TestCaseExit () and put the do/except handling there. You can even trap specific exception numbers and write out different (more helpful) error messages if need be.
Ok, so you can reraise the exception:
this way the exception is propagated outside the testcase.
so given the following testcases:
You could write a main function:
where execution would stop after fred(exception is raised in fred testcase) but continue with barney.
This could be useful where, given a grouping of testcases specific to a certain aspect of the AUT, you do not want subsequent testcases to run should there be any failures. So when fred fails, I definitely do not want to bother attempting to run bambam and wilma, but I do want the rubble tests to run.
Obviously, if you do this sort of thing it means that you could no longer run a script of testcases from top to bottom (which is the default behaviour) because if one crashed out execution of the script would stop, but that's OK, you could build in conditional behaviour to TestCaseExit.
The only other problem is this:
Have I got the cave kids with the right families or are they mutually babysitting...?
[This message has been edited by johntest (edited 02-13-2003).]