Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    GWTTestCase?

    It surprised me when I could not boot strap a simple java-based smartgwt ui in a GWTTestCase. Is this a known issue?

    I can provide more detail if you like, but the following simple cases all fail with a javascript exception:

    Code:
     
    public class DashboardUiShould extends GWTTestCase {
      public void testUi() {
        HLayout hLayout = new HLayout();
        hLayout.draw();
        //...
    
      public void testUi() {
        HLayout hLayout = new HLayout();
        RootPanel.get().add(hLayout);
        //...
    
      public void testUi() {
        HLayout hLayout = new HLayout();
        RootLayoutPanel.get().add(hLayout);
        //...
    Last edited by wil.pannell; 14 Aug 2011, 23:11.

    #2
    For any JavaScript exception, you should post a stack trace (see FAQ).

    Note there is a known bug in GwtTestCase (not SmartGWT) where it doesn't run GWT linkers - see this post.

    Finally, consider other tools - we believe we're seeing a trend of moving away from GwtTestCase. At HQ we use Selenium with Selenium Remote Control - SmartGWT has special support for this (see the "selenium" directory in the SDK). Also consider mocking frameworks - see this thread for samples.

    Comment


      #3
      Thanks for your reply and the reference to the known GWTTestCase issue.

      We use Selenium 2.x with the support provided by SmartGWT. We also use Mockito and segregate our design based on MVP.

      Our use of GWTTestCase is strictly in regards to code coverage. Each SmartGWT UI implements a lean interface that's designed during junit test development. We simply wish to bootstrap the SmartGWT UI in a GWTTestCase harness, call it's public api, and verify that non-public methods are well-covered.

      The stack trace posted below occurs even when we <inherits name='com.smartgwtee.SmartGwtEENoTheme' />:

      Code:
      java.lang.RuntimeException: Remote test failed at 172.18.0.207 / Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.19) Gecko/2010031422 Firefox/3.0.19
      	at com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:1288)
      	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1408)
      	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
      	at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:650)
      	at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
      	at junit.framework.TestCase.runBare(TestCase.java:134)
      	at junit.framework.TestResult$1.protect(TestResult.java:110)
      	at junit.framework.TestResult.runProtected(TestResult.java:128)
      	at junit.framework.TestResult.run(TestResult.java:113)
      	at junit.framework.TestCase.run(TestCase.java:124)
      	at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
      	at junit.framework.TestSuite.runTest(TestSuite.java:232)
      	at junit.framework.TestSuite.run(TestSuite.java:227)
      	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
      	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
      	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
      	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
      Caused by: java.lang.Exception: com.google.gwt.core.client.JavaScriptException: (null): null
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
      	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
      	at com.smartgwt.client.widgets.Canvas.onInit(Canvas.java)
      	at com.smartgwt.client.widgets.layout.Layout.onInit(Layout.java:1054)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
      	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
      	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
      	at com.smartgwt.client.widgets.BaseWidget.doInit(BaseWidget.java)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
      	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
      	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
      	at com.smartgwt.client.widgets.layout.HLayout.create(HLayout.java)
      	at com.smartgwt.client.widgets.BaseWidget.getOrCreateJsObj(BaseWidget.java:361)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
      	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
      	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
      	at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java)
      	at com.blazent.web.places.SmartGwtUiShould.testBootStrapSimpleWidgetInGWTTestHarness(SmartGwtUiShould.java:15)
      	at com.blazent.web.places.__SmartGwtUiShould_unitTestImpl.doRunTest(__SmartGwtUiShould_unitTestImpl.java:7)
      	at junit.framework.TestCase.runTest(TestCase.java:62)
      	at com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java:188)
      	at com.google.gwt.junit.client.GWTTestCase.__doRunTest(GWTTestCase.java:129)
      	at com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java:389)
      	at com.google.gwt.junit.client.impl.GWTRunner.doRunTest(GWTRunner.java:318)
      	at com.google.gwt.junit.client.impl.GWTRunner.access$9(GWTRunner.java:312)
      	at com.google.gwt.junit.client.impl.GWTRunner$TestBlockListener.onSuccess(GWTRunner.java:107)
      	at com.google.gwt.junit.client.impl.GWTRunner$InitialResponseListener.onSuccess(GWTRunner.java:63)
      	at com.google.gwt.junit.client.impl.GWTRunner$InitialResponseListener.onSuccess(GWTRunner.java:1)
      	at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:232)
      	at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
      	at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
      	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
      	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
      	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
      	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
      	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
      	at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
      	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:221)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
      	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
      	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
      	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
      	at java.lang.Thread.run(Thread.java:680)
      Last edited by wil.pannell; 18 Aug 2011, 03:21.

      Comment


        #4
        Is this the only issue you see? No bogus reference to isomorphic.gwt.xml as in the GWT issue we linked to? No other error indications?

        Are you able to open the Developer Console in compiled mode to see if there is a JavaScript stack trace?

        Comment


          #5
          Correct. So far, this is the only issue I've seen.

          When the gwt test case is run remotely in firefox in compiled mode, I get the following stack trace:

          Code:
          java.lang.RuntimeException: Remote test failed at 172.18.0.207 / Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:2.0) Gecko/20100101 Firefox/4.0
          	at com.google.gwt.junit.JUnitShell.processTestResult(JUnitShell.java:1288)
          	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1408)
          	at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
          	at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:650)
          	at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:441)
          	at junit.framework.TestCase.runBare(TestCase.java:134)
          	at junit.framework.TestResult$1.protect(TestResult.java:110)
          	at junit.framework.TestResult.runProtected(TestResult.java:128)
          	at junit.framework.TestResult.run(TestResult.java:113)
          	at junit.framework.TestCase.run(TestCase.java:124)
          	at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:296)
          	at junit.framework.TestSuite.runTest(TestSuite.java:232)
          	at junit.framework.TestSuite.run(TestSuite.java:227)
          	at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
          	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
          	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
          	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
          Caused by: java.lang.Exception: com.google.gwt.core.client.JavaScriptException: (ReferenceError): $debox is not defined
          	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:237)
          	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
          	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
          	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeVoid(ModuleSpace.java:289)
          	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeVoid(JavaScriptHost.java:107)
          	at com.smartgwt.client.widgets.BaseWidget.draw(BaseWidget.java)
          	at com.blazent.web.places.SmartGwtUiShould.testBootStrapSimpleWidgetInGwtTestCase(SmartGwtUiShould.java:15)
          	at com.blazent.web.places.__SmartGwtUiShould_unitTestImpl.doRunTest(__SmartGwtUiShould_unitTestImpl.java:7)
          	at junit.framework.TestCase.runTest(TestCase.java:62)
          	at com.google.gwt.junit.client.GWTTestCase.runBare(GWTTestCase.java:188)
          	at com.google.gwt.junit.client.GWTTestCase.__doRunTest(GWTTestCase.java:129)
          	at com.google.gwt.junit.client.impl.GWTRunner.runTest(GWTRunner.java:389)
          	at com.google.gwt.junit.client.impl.GWTRunner.doRunTest(GWTRunner.java:318)
          	at com.google.gwt.junit.client.impl.GWTRunner.access$9(GWTRunner.java:312)
          	at com.google.gwt.junit.client.impl.GWTRunner$TestBlockListener.onSuccess(GWTRunner.java:107)
          	at com.google.gwt.junit.client.impl.GWTRunner$InitialResponseListener.onSuccess(GWTRunner.java:63)
          	at com.google.gwt.junit.client.impl.GWTRunner$InitialResponseListener.onSuccess(GWTRunner.java:1)
          	at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java:232)
          	at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java:287)
          	at com.google.gwt.http.client.RequestBuilder$1.onReadyStateChange(RequestBuilder.java:395)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:597)
          	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
          	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
          	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
          	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java:326)
          	at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java:207)
          	at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java:132)
          	at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java:561)
          	at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java:269)
          	at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java:91)
          	at com.google.gwt.core.client.impl.Impl.apply(Impl.java)
          	at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:221)
          	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
          	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
          	at java.lang.reflect.Method.invoke(Method.java:597)
          	at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
          	at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
          	at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:167)
          	at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:281)
          	at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:531)
          	at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:352)
          	at java.lang.Thread.run(Thread.java:680)

          Comment


            #6
            Hi Isomorphic,

            Are there any prospects on this issue?

            Cheers!

            (Nice work on rel 2.5, btw.)

            Comment


              #7
              Unfortunately, this error basically suggests that GWTTestCase still has the serious bug that it does not run custom compiler add-ons. We have to recommend avoiding this technology for now - Selenium, mockup toolkits and other approaches are the way to go.

              Comment

              Working...
              X