Hello,
I created a module containing GWTTestCases as described here (I am
using GWT 1.5.2 on Windows XP):
http://code.google.com/docreader/#p=google-web-toolkit-doc-1-5&s=google-web-toolkit-doc-1-5&t=DevGuideJUnitSuites
and here
http://60-248-16-66.hinet-ip.hinet.net/GWT/doc/html/com.google.gwt.doc.DeveloperGuide.JUnitIntegration.html
I have one GWTTestCase class and one GWTTestSuite class. Here is the
code:
8< - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
package test.client;
import junit.framework.Test;
import junit.framework.TestSuite;
import com.google.gwt.junit.tools.GWTTestSuite;
public class TestTestSuite extends GWTTestSuite {
public static Test suite() {
TestSuite suite = new TestSuite("Tests");
suite.addTestSuite(TestTest.class);
return suite;
}
}
---
package test.client;
import com.google.gwt.junit.client.GWTTestCase;
public class TestTest extends GWTTestCase {
@Override
public String getModuleName() {
return "test.Test";
}
public void testStuff() {
assertTrue(2 + 2 == 4);
}
}
>8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
And here is the Module xml:
<module>
<inherits name='com.google.gwt.junit.JUnit'/>
</module>
Invoking the test case using the following command line works:
@java -Dgwt.args="-out www-test" -Xmx256M -cp ".\src;.\bin;.\lib
\junit.jar;.\lib\gwt-user.jar;.\lib\gwt-dev-windows.jar"
junit.textui.TestRunner test.client.TestTest %*
Invoking the TestTestSuite using the following command line:
@java -Dgwt.args="-out www-test" -Xmx256M -cp ".\src;.\bin;.\lib
\junit.jar;.\lib\gwt-user.jar;.\lib\gwt-dev-windows.jar"
junit.textui.TestRunner test.client.TestTestSuite %*
fails with the error message:
Error: java.lang.ClassCastException: class test.client.TestTestSuite
I checked the class path several times. All src folders and jars are
present.
I played around with the code a bit. Letting the TestTestSuite class
inherit from GWTTestCase works (to some extend). Here is the changed
code:
package test.client;
import junit.framework.Test;
import com.google.gwt.junit.client.GWTTestCase;
import com.google.gwt.junit.tools.GWTTestSuite;
public class TestTestSuite extends GWTTestCase {
@Override
public String getModuleName() {
return "test.Test";
}
public static Test suite() {
GWTTestSuite suite = new GWTTestSuite("Tests");
suite.addTestSuite(TestTest.class);
return suite;
}
}
Now the test case is run. However, the GWT compiler complains with
some error messages:
Removing units with errors
[ERROR] Errors in 'file:/<path goes here>/src/test/client/
TestTestSuite.java'
[ERROR] Line 17: No source code is available for type
com.google.gwt.junit.tools.GWTTestSuite; did you forget to inherit a
required module?
I have no idea which module could be missing.
Any ideas from the GWT experts?
Cheers,
Jan