Sunday, September 12, 2010

Difficult running a GWTTestCase

Hi,

I seek advice and help getting my first GWTTestCase running within
Eclipse.

I generated a new web application with the Eclipse GWT/Google App
Engine plug ins. I created a module and am having difficulty getting
my first GWTTestCase to run. I get the following error when I execute
the GWTTestCase within Eclipse, which states my test case is not in
the class path.

com.google.gwt.junit.JUnitFatalLaunchException: The test class
'com.myapp.client.MyAppTest' was not found in module
'com.myapp.MyApp'; no compilation unit for that type was seen

I am confused by this error, since I placed the test class in the
generated "com.MyApp.client" package. My gwt.xml is also generated by
Eclipse and contains the <source path='client'/> entry it in, so I
need further help understanding why my GWTUnitTest won't run.

My application runs as expected in hosted mode and when deployed. I
want to start writing unit tests and need help. What am I missing?

MyAppTest.java
-----
package com.myapp.client;

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

public class MyAppTest extends GWTTestCase {

@Override
public String getModuleName() {
return "com.myapp.MyApp";
}

public void testLoadMyAppProcedure() {
MyApp module = new MyApp();
module.loadMyAppProcedure();
}
}

Eclipse JUnit Error
-----
com.google.gwt.junit.JUnitFatalLaunchException: The test class
'com.myapp.client.MyAppTest' was not found in module
'com.myapp.MyApp'; no compilation unit for that type was seen
at
com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:
605)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1189)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:1152)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:541)
at com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:
406)
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:282)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
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)


References:

http://code.google.com/webtoolkit/doc/latest/DevGuideTesting.html

http://code.google.com/webtoolkit/articles/testing_methodologies_using_gwt.html

--
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