Friday, July 29, 2011

Tested class changes not visible to test class using gwt-maven-plugin

Can anyone help with this? (I know there is a separate mailing list
for gwt-maven-plugin but I'm not sure it has a lot of subscribers.)

Given that you have a JUnit test case class in /src/test/java/*/
FooTest.java and a tested class /src/main/java/*/Foo.java. If you
attempt run your test case in FooTest.java you will get a runtime
error indicating that FooTest doesn't have access to the modified
Foo.class file.

Steps to reproduce.
1) Generate a GWT project using the gwt-maven-plugin archetype.
2) Import the project into Eclipse using new->Existing Projects into
Workspace.
3) Create class Foo.java in /src/main/java/**/client.
4) Define a simple test method in Foo.java "public hello(){return
"hello"}"
5) Create class FooTest.java in /src/test/java/**/client.
6) Define a test in FooTest.java:
"@Test public void testFooTest() {Foo foo = new Foo();
assertEquals("hello", foo.hello());}
7) Run the test case method. You will get a runtime message
complaining that Foo can't be found.

A workaround is to:
1) open the junit run configuration.
2) select the classpath tab.
3) select user entries
4) click advanced button
5) select "Add folders" radio button
6) click ok button
7) add folder src/main/webapp/WEB-INF/classes

Its not a great workaround since you have to do this with every test
case run configuration.

Another workaround is to run Project/clean on the project.

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

1 comment: