GWT test case fail to run: JUnitFatalLaunchException
Asked Answered
F

3

6

I am trying to run GWT test from eclipse 3.6 but have stuck with this strange error.

The test class 'com.company.demo.smartgwt.RequestBuilderTest' was not found in module 'com.company.demo.smartgwt.module'; no compilation unit for that type was seen

Have tried adding source folder into Run Dialog--> classpath and source tabs as mentioned here. No luck yet and running out of options.. Any suggestions folks?

Full error stack:


com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.company.demo.smartgwt.RequestBuilderTest' was not found in module 'com.company.demo.smartgwt.module'; no compilation unit for that type was seen
    at com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:718)
    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1317)
    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1280)
    at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:625)
    at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:456)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at junit.framework.TestResult$1.protect(TestResult.java:106)
    at junit.framework.TestResult.runProtected(TestResult.java:124)
    at junit.framework.TestResult.run(TestResult.java:109)
    at junit.framework.TestCase.run(TestCase.java:118)
    at com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:311)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
    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)
Fame answered 3/3, 2011 at 12:14 Comment(1)
Some interesting hints can be found at raibledesigns.com/rd/entry/testing_gwt_applications also.Anathematize
F
4

The GWT test was not in the same package as the class under test.. moving it into the same package resolved this issue. Strange though

Fame answered 3/3, 2011 at 13:48 Comment(2)
The GWT tests are too slow to run, you can try your hands on using Junit and Mockito to speed up the tests of interaction between widgetsAletheaalethia
A useful link on GWT unit testing blog.hivedevelopment.co.uk/2009/10/…Fame
T
16

The issue is probably that you have run the test as a JUnitTest rather than a GWT Junit Testcase.

In Eclipse, delete your run configuration for the test, right click the class, press "Run As" and select "GWT Test Case".

Worked for me.

I will agree with other answers that GWT test are too slow - but unfortunatrely , you may need them occassionally.

Twannatwattle answered 16/11, 2011 at 23:37 Comment(1)
If the "GWT Test Case" doesn't happen to show up, ensure that the project has "Use Google Web Toolkit" checkbox checked in "Project Properties->Google->Web Toolkit".Tetanus
F
4

The GWT test was not in the same package as the class under test.. moving it into the same package resolved this issue. Strange though

Fame answered 3/3, 2011 at 13:48 Comment(2)
The GWT tests are too slow to run, you can try your hands on using Junit and Mockito to speed up the tests of interaction between widgetsAletheaalethia
A useful link on GWT unit testing blog.hivedevelopment.co.uk/2009/10/…Fame
S
2

Look at your GWTTestCase.getModuleName() method and make sure it's returning the right module.

Staid answered 27/3, 2012 at 17:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.