On Fri, Oct 1, 2010 at 1:00 PM, Damon Lundin <damon.lun...@gmail.com> wrote:

> Thanks for the help Scott.  The problem is not with the
> delayTestFinish.  Apparently our tests are throwing uncaught
> exceptions which causes the test to finish.  The exception does appear
> in our logs, but it's one of these:
>
> Caused by: com.google.gwt.core.client.JavaScriptException: (Error):
> Unspecified error.
>  number: -2147467259
>  description: Unspecified error.
>        at
>
> com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:
> 237)
>
> Which are not terribly useful (if you have any useful suggestions on
> dealing with these, I'm all ears) so I moved on to the next exception
> which was an NPE in our code.  That NPE is caused by the tests running
> on top of each other.  So I guess this was my fault for not paying
> closer attention to the first exception.
>
> There is perhaps one possible recommendation that could come out of
> this and maybe that is that when a test begins (or finishes) it
> cancels all outstanding timers, commands and pending async callbacks
> (perhaps optionally).  The confusion occurred here because even though
> the previous test threw an uncaught exception and finished allowing
> the next test to begin, the outstanding commands started by the
> previous test were still allowed to run and when they did, they messed
> up the shared state used by the next test.
>
> Of course now I have to go figure out what's causing this uncaught
> exception to be thrown :-(.  And I'm also still confused why the tests
> pass when run one at a time.


If your test code ultimately involves callbacks from the browser event loop
from your own code, you need to wrap all such calls in $entry, which hooks
up the uncaught exception handler and the Scheduler hooks.  All of the GWT
widgets/etc that do this already take care of it, but if you write your own
you have to handle it.

Look at JsopRequest for an example, but basically if you set a callback
foo.callback = function()... then that should instead be
foo.callback=$entry(function()...).

-- 
John A. Tamplin
Software Engineer (GWT), Google

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to