trying to test non-test classes?

116 views
Skip to first unread message

Arthur Kalmenson

unread,
Nov 19, 2008, 3:06:49 PM11/19/08
to gwt-...@googlegroups.com
Hello everyone,

As I was trying to figure out why gwt-maven isn't running my
GWTTestSuite and I came across a strange bug. It seems that when you
name your GWTTestCase "Test<name>" as the "Use GWTTestSuite padawan"
here (http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plugin/testing.html)
says to, it's still being run. I created a new test project with the
archetype and I renamed the GWTTestExampleA to TestExampleA. Here's my
maven run:

arthur@ares:~/work/gwt-example$ mvn test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building gwt-maven-archetype-project
[INFO] task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile]
[INFO] Compiling 1 source file to /home/arthur/work/gwt-example/target/classes
[INFO] [dependency:unpack {execution: unpack}]
[INFO] Configured Artifact: com.google.gwt:gwt-dev:linux-libs:1.5.3:zip
[INFO] Unpacking
/home/arthur/.m2/repository/com/google/gwt/gwt-dev/1.5.3/gwt-dev-1.5.3-linux-libs.zipto
/home/arthur/.m2/repository/com/google/gwt/gwt-dev/1.5.3
with Includes null and excludes:null
[INFO] [gwt:compile {execution: default}]
[INFO] establishing classpath list (buildClaspathList - scope = COMPILE)
[INFO] google.webtoolkit.home (gwtHome) *not* set, using project POM
for GWT dependencies
Compiling module com.example.Application
Compilation succeeded
Linking compilation into
/home/arthur/work/gwt-example/target/gwt-example-1.0-SNAPSHOT/com.example.Application
[INFO] [resources:testResources]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered
resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory
/home/arthur/work/gwt-example/src/test/resources
[INFO] [compiler:testCompile]
[INFO] Compiling 2 source files to
/home/arthur/work/gwt-example/target/test-classes
[INFO] [surefire:test]
[INFO] Surefire report directory:
/home/arthur/work/gwt-example/target/surefire-reports

-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.example.AStandardNonGwtTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.043 sec
Running com.example.client.TestExampleA
Loading module 'com.example.Application.JUnit'
Loading inherited module 'com.example.Application'
[ERROR] Unable to find 'com/example/Application.gwt.xml' on your
classpath; could be a typo, or maybe you forgot to include a classpath
entry for source?
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.697
sec <<< FAILURE!

Results :

Tests in error:
testSomething(com.example.client.TestExampleA)

Tests run: 2, Failures: 0, Errors: 1, Skipped: 0

[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] There are test failures.

Please refer to /home/arthur/work/gwt-example/target/surefire-reports
for the individual test results.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 36 seconds
[INFO] Finished at: Wed Nov 19 14:57:40 EST 2008
[INFO] Final Memory: 16M/29M
[INFO] ------------------------------------------------------------------------


--
Arthur Kalmenson

Charlie Collins

unread,
Nov 19, 2008, 4:43:48 PM11/19/08
to gwt-maven
Yes, good catch there. I was just plain wrong when I wrote that ;).

The issue there is again that Surefire "found" that test, and if it's
a GWTTestCast test that Surefire finds, stuff goes bad.

By default Surefire picks up stuff that starts with or ends with
"Test": http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclusion-exclusion.html.
So again, basically, I was wrong. Name it something Surefire won't
latch on to, or configure Surefire to not pick up "TestSomething"
tests.

I am going to change the docs to say something like "something that
does not start OR end with Test." Like SomethingGwtTst or . . . I
can't think of a good one, but you get the idea (that trick DOES
actually work, if you get the names right).

On Nov 19, 3:06 pm, "Arthur Kalmenson" <arthur.k...@gmail.com> wrote:
> Hello everyone,
>
> As I was trying to figure out why gwt-maven isn't running my
> GWTTestSuite and I came across a strange bug. It seems that when you
> name your GWTTestCase "Test<name>" as the "Use GWTTestSuite padawan"
> here (http://gwt-maven.googlecode.com/svn/docs/maven-googlewebtoolkit2-plug...)

Charlie Collins

unread,
Nov 19, 2008, 4:54:24 PM11/19/08
to gwt-maven
I have updated the docs, and updated the simplesample (it now uses a
"GwtTst" prefix, rather than "Test", to indicate tests that are GWT
but in the Suite, so that Surefire won't pick them up, and also so
that GWT-Maven won't run them outside of the Suite).

On Nov 19, 4:43 pm, Charlie Collins <charlie.coll...@gmail.com> wrote:
> Yes, good catch there.  I was just plain wrong when I wrote that ;).
>
> The issue there is again that Surefire "found" that test, and if it's
> a GWTTestCast test that Surefire finds, stuff goes bad.
>
> By default Surefire picks up stuff that starts with or ends with
> "Test":http://maven.apache.org/plugins/maven-surefire-plugin/examples/inclus....

Arthur Kalmenson

unread,
Nov 20, 2008, 9:29:33 AM11/20/08
to gwt-...@googlegroups.com
Great! Everything works now. This also solves the problem here:
http://groups.google.com/group/gwt-maven/browse_thread/thread/7090f07f02818195

--
Arthur Kalmenson

Miles T.

unread,
Nov 28, 2008, 2:30:41 AM11/28/08
to gwt-maven
Hi,

By the way, GWT tests can be launched with surefire plugin with the
following configuration :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<additionalClasspathElements>
<additionalClasspathElement>${project.build.sourceDirectory}</
additionalClasspathElement>
<additionalClasspathElement>${project.build.testSourceDirectory}
</additionalClasspathElement>
</additionalClasspathElements>
<useSystemClassLoader>true</useSystemClassLoader>
<useManifestOnlyJar>false</useManifestOnlyJar>
<forkMode>always</forkMode>
<systemProperties>
<property>
<name>gwt.args</name>
<value>-out target/www</value>
</property>
</systemProperties>
<argLine>-Xmx256m</argLine>
</configuration>
</plugin>


On 20 nov, 15:29, "Arthur Kalmenson" <arthur.k...@gmail.com> wrote:
> Great! Everything works now. This also solves the problem here:http://groups.google.com/group/gwt-maven/browse_thread/thread/7090f07...
>
> --
> Arthur Kalmenson
>
> On Wed, Nov 19, 2008 at 4:54 PM, Charlie Collins
>

Charlie Collins

unread,
Nov 28, 2008, 5:11:34 PM11/28/08
to gwt-maven
I haven't tested this config yet, but if it works, then we don't need
a test mojo ;). This looks very similar though to some stuff I
already tried back when, but I will give it another shot using this
setup.

thanks for the info

Miles T.

unread,
Dec 1, 2008, 4:53:41 AM12/1/08
to gwt-maven
Actually, the combination of useSystemClassLoader, useManifestOnlyJar
and forkMode is the only one combination working for me. And it
doesn't work with surefire 2.4.2, you must explicitly ask for 2.4.3.
You must also know that it could not work on older Windows because of
the command line length issue (look at
http://maven.apache.org/plugins/maven-surefire-plugin/examples/class-loading.html).

Charlie Collins

unread,
Dec 1, 2008, 1:23:39 PM12/1/08
to gwt-maven
I will check it out, and thanks again for the help.

On Dec 1, 4:53 am, "Miles T." <dupont.nico...@gmail.com> wrote:
> Actually, the combination of useSystemClassLoader, useManifestOnlyJar
> and forkMode is the only one combination working for me. And it
> doesn't work with surefire 2.4.2, you must explicitly ask for 2.4.3.
> You must also know that it could not work on older Windows because of
> the command line length issue (look athttp://maven.apache.org/plugins/maven-surefire-plugin/examples/class-...).
Reply all
Reply to author
Forward
0 new messages