On Wed, Dec 3, 2008 at 3:11 PM, Joel Webber <[EMAIL PROTECTED]> wrote:
> So here are all the ways I can think of for a test method to complete, > either synchronously or asynchronously. Those not explicitly marked as such > work properly. > > Normal synchronous test methods: > - Test method completes successfully and synchronously. > - Test method triggers an exception synchronously (*not* from within an > event handler). > > Normal asynchronous test methods: > - Test method goes into async mode, returns, then passes (called > finishTest()). > - Test method goes into async mode, returns, then fails by triggering an > exception in an event handler. > - Test method goes into async mode, returns, then fails by timing out. > > Weird cases: > - Test method triggers an exception synchronously *from an event handler*. > - As described above, the exception is thrown away from GWTTestCase's > onUncaughtException(). > - Test method completes synchronously, then triggers an exception between > test methods. > - Uncertain, but I believe it just throws away the exception, as in the > above case. > It would throw it away. This is kind of the weirdest case, because you've actually already reported a result for a case that you later discover failed, and you're waiting on an XHR to see what to run next. I suppose you could immediately fail the *next* test once it's ready with a PreviouslyFailedTestException. > - Test method completes [a]synchronously, then triggers an exception during > the next test method. > - The delayed exception causes the *next* test to report failure, which > seems somewhat wrong. > - But the stack trace still shows the actual point where the exception > occurred. > > What those last to "weird cases" lead me to believe is that we're not > really defending against anything by throwing away uncaught exceptions, and > that we should be able to allow all uncaught exceptions to 'fail' the > current test (even if it ends up being the wrong one). Are there any other > cases I'm missing here, or some subtle reason we can't do this? > This seems reasonable, I just wanted to enumerate the cases and make sure it makes sense. Other weird cases I can think of (there may be more): - Test method triggers an exception synchronously after setting up an async state - Test method triggers an exception synchronously *from an event handler* after setting up an async state (but before the method returns) - Test method triggers an exception synchronously *from an event handler*, then throws an exception itself synchronously. (We report a CaughtPlusUncaughtAtTheSameTimeException that contains both?) :) --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/Google-Web-Toolkit-Contributors -~----------~----~----~----~------~----~------~--~---
