Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GWT test case fail to run: JUnitFatalLaunchException

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)
like image 631
MountainRock Avatar asked Mar 03 '11 12:03

MountainRock


3 Answers

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.

like image 78
brucko Avatar answered Nov 09 '22 15:11

brucko


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

like image 27
MountainRock Avatar answered Nov 09 '22 15:11

MountainRock


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

like image 2
Eric Landry Avatar answered Nov 09 '22 14:11

Eric Landry