Sunday
Feb082009
Getting Rid of Flakiness in GWT RPC Tests

To avoid flaky RPC testing in GWT tests, use fake service implementation which you inject directly into the constructor of your custom widget. There will be no delays, and you will be in complete control.
with real service | with injected fake service |
public void testSomethingHappened() { CustomWidget w = new CustomWidget(); w.doSomethingThatTriggersRpcCall(); Timer timer = new Timer() { | public void testSomethingHappened() { Service fake = new FakeService(); CustomWidget w = new CustomWidget(fake); w.doSomethingThatTriggersRpcCall(); assertTrue(widget.somethingHappened()); } |
Reader Comments