Friday, July 29, 2011

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

I have the same issue, and am using a similar workaround. The only difference is that I add the external class folder to my Java build path. When I run JUnit tests, I make sure the class folder is at the top of the Order and Export list, and when in standard development I put it at the bottom.

This way it works for all test cases - but still not a great workaround.
-- 
Sébastien Tromp

2011/7/29 cri <chuck.irvine.ks@gmail.com>
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.


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