Monday, October 31, 2011

Unit teting using GWTTestCase

I am getting following error when I tried to test using GWTTestCases.

com.google.gwt.junit.JUnitFatalLaunchException: The test class
'com.abc.myapp.client.MyAppTestCase' was not found in module
'com.abc.myapp.Myapp'; no compilation unit for that type was seen
at
com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:
743)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1346)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1309)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:653)
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:
91)
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)

Here is the test class source code.

package com.abc.myapp.client;

import org.junit.Assert;
import com.google.gwt.junit.client.GWTTestCase;

public class MyAppTestCase extends GWTTestCase {
@Override
public String getModuleName() {
return "com.abc.myapp.Myapp";
}

public void testX(){
Assert.assertTrue(true);
}
}

In eclispe I am using following set up, it is as per maven standard.
src/main/java for which output folder is target/classes
src/main/resources for which output folder is target/classes
src/main/webapp
src/test/java for which output folder is target/test-
classes
src/test/resources for which output folder is target/test-
classes

Let me know if I am missing anything else.

FYI!, I am using GWT 2.3.

Thanks,

Vish

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment