What is the correct way to ignore test classes when compiling GWT and still being able to run GWTTestCases?

699 views
Skip to first unread message

l3dx

unread,
Jan 21, 2013, 6:24:21 AM1/21/13
to google-we...@googlegroups.com
Hello all!

I'm a bit confused when it comes to GWT compilation and test classes. Please enlighten me! :-)

Currently I have some trouble running a GWTTestCase test. I get the following compilation error:

The test class 'x.PageIntegrationTestGWT' was not found in module 'x.GwtIntegrationTest'; no compilation unit for that type was seen

This is caused by this source/exclude configuration in the GWT module:

<source path="client">
     <exclude name="**/*Test*.java"/>
     <exclude name="**/*Mock*.java"/>
</source>

The reason we use the wildcard at the end of Test* is that we use a postfix annotation to determine which tests to run when (unit/integration and so on..). Is there an "easy" way to fix my problem, or do I have to explicitly exclude each variant of Test except TestGWT?

I tried creating a separate module definition that inherits the real one, and override the source/exclude configuration, but without any luck.

Thanks!

Thomas

Thomas Broyer

unread,
Jan 21, 2013, 7:08:16 AM1/21/13
to google-we...@googlegroups.com
Not sure I understand the problem, but you might want to try <skip> instead of <exclude>. <skip> is "do not include those files in this particular module, but another module might include them" whereas <exclude> is "do not include those files, never ever" (AFAICT).

I've never had to deal with such exclusions for test classes though: when compiling the app, simply do not put the test classes in the classpath. It very much depends how you build project (Ant vs. Make vs. whatever) and how you organize your files (separate src/ vs. test/, or src/main vs. src/test, folders vs. everything in the same folder)

Finally, note that if you want to "exclude each variant of Test except TestGWT" then it should be enough to <include>**/*TestGWT.java</include> instead.

tskardal

unread,
Jan 23, 2013, 2:59:44 AM1/23/13
to google-we...@googlegroups.com
The project uses maven and hence its conventions. To be honest, I'm not sure why we have these excludes in our module configuration, but anyway. I ended up adding more specific excludes, to include the TestGWT, but not the other kinds of tests.

Didn't know about <skip> vs <exclude>! Haven't tried using it yet though. I read your answer after closing the case.

Thanks :)
Reply all
Reply to author
Forward
0 new messages