Saturday, August 29, 2009

GWT Test Execution Error

Problem:

When try to execute a test class that inherits from GWTTestCase the following message error is displayed:

com.google.gwt.junit.JUnitFatalLaunchException: The test class 'stories.SomeStoryTest' was not found in module'com.appspot.projectname.ProjectName; no compilation unit for that type was seen
    at com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:390)
    at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:626)
    at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:346)
    at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:219)
    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:132)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

 

Reason:

The test class SomeStoryTest should be in the same package of the GWT Module, or in a subpackage.

Solution:

Change de package of the test class. In this example, change from  story.SomeStoryTest to com.appspot.projectname.client.SomeStoryTest or to some subpackage as in com.appspot.projectname.client.stories.SomeStoryTest.

Related links:

http://code.google.com/intl/pt-BR/webtoolkit/doc/1.6/DevGuideTesting.html

http://www.ibm.com/developerworks/java/library/j-cq07247/index.html

Sorry any mistake in English. :)

No comments:

Post a Comment