mvn gwt:testGwt doesn't run tests

5 views
Skip to first unread message

louis011010

unread,
May 16, 2008, 7:16:00 PM5/16/08
to gwt-maven
Hi,

mvn gwt:testGwt passed a test doom to fail, and according to the
output message "OK (0 tests)" I believe it didn't even run the test.
Can anyone help please?

@Environment
=============
Ubuntu Hardy Heron
Maven version: 2.0.9
Java version: 1.6.0_06

@Console message
==================
louis@abulafia:~/programming/code/manual/mygwt$ mvn gwt:compile
gwt:testGwt
[INFO] Scanning for projects...
[INFO] Searching repository for plugin with prefix: 'gwt'.
[INFO]
------------------------------------------------------------------------
[INFO] Building mygwt Maven Webapp
[INFO] task-segment: [gwt:compile, gwt:testGwt]
[INFO]
------------------------------------------------------------------------
[INFO] [gwt:compile]
Override:
Output will be written into /home/louis/programming/code/manual/mygwt/
target/mygwt/idv.louis.MyGwt
Compilation succeeded
[INFO] [gwt:testGwt]
OK (0 tests)
[INFO]
------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 8 seconds
[INFO] Finished at: Sat May 17 07:09:42 CST 2008
[INFO] Final Memory: 5M/82M
[INFO]
------------------------------------------------------------------------
louis@abulafia:~/programming/code/manual/mygwt$


@Directory Layout
==========================
src
|-- main
| |-- java
| | `-- idv
| | `-- louis
| | |-- MyGwt.gwt.xml
| | |-- client
| | | |-- IMyService.java
| | | |-- IMyServiceAsync.java
| | | `-- MyGwt.java
| | |-- public
| | | `-- MyGwt.html
| | `-- server
| | `-- MyService.java
| |-- resources
| `-- webapp
| |-- WEB-INF
| | `-- web.xml
| `-- index.jsp
`-- test
`-- java
`-- idv
`-- louis
|-- client
| `-- MyGwtTest.java
`-- server

@MyGwtTest.java
===============================
public class MyGwtTest extends GWTTestCase {

public String getModuleName() {
return "idv.louis.MyGwt";
}

public void testSimple() {
fail();
}
}



@pom.xml
=================================================
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://
www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://
maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>idv.louis</groupId>
<artifactId>mygwt</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>mygwt Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<version>1.4.62</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-servlet</artifactId>
<version>1.4.62</version>
<scope>runtime</scope>
</dependency>
</dependencies>
<build>
<finalName>mygwt</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.0</version>
<configuration>
<source>1.4</source>
<target>1.4</target>
</configuration>
</plugin>
<plugin>
<groupId>com.totsp.gwt</groupId>
<artifactId>maven-googlewebtoolkit2-plugin</artifactId>
<configuration>
<logLevel>INFO</logLevel>
<runTarget>idv.louis.MyGwt/MyGwt.html</runTarget>
<compileTargets>
<param>idv.louis.MyGwt</param>
</compileTargets>
</configuration>
<executions>
<execution>
<goals>
<goal>generateClientBeans</goal>
<goal>mergewebxml</goal>
<goal>compile</goal>
<goal>testGwt</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

Charlie Collins

unread,
May 20, 2008, 8:30:42 AM5/20/08
to gwt-maven
I honestly don't recall exactly why or where, but I think I have seen
this before - try just running "mvn test" rather than trying to
directly invoke it, and see if that works (if that does work, we can
possibly work backwards to figure out why you can't manually invoke it
the way you did).
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://

louis011010

unread,
May 21, 2008, 2:46:51 PM5/21/08
to gwt-maven
Actually before trying `mvn gwt:testGwt`, my first atttmpt to run test
is to issue `mvn test`, the test was run but the result was not
exciting:

@surefire-reports
=============================================================
-------------------------------------------------------------------------------
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.139
sec <<< FAILURE!
testSimple(idv.louis.client.MyGwtTest) Time elapsed: 1.076 sec <<<
ERROR!
java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:394)
at java.util.Properties.setProperty(Properties.java:143)
at java.lang.System.setProperty(System.java:731)
at
com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.<init>(EmbeddedTomcatServer.java:
171)
at
com.google.gwt.dev.shell.tomcat.EmbeddedTomcatServer.start(EmbeddedTomcatServer.java:
62)
at com.google.gwt.dev.GWTShell.startUp(GWTShell.java:742)
at
com.google.gwt.junit.JUnitShell.getUnitTestShell(JUnitShell.java:185)
at com.google.gwt.junit.JUnitShell.runTest(JUnitShell.java:
167)
at
com.google.gwt.junit.client.GWTTestCase.runTest(GWTTestCase.java:194)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:
124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at
com.google.gwt.junit.client.GWTTestCase.run(GWTTestCase.java:114)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:
213)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:
140)
at
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:
127)
at org.apache.maven.surefire.Surefire.run(Surefire.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:
338)
at
org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:
997)

Charlie Collins

unread,
May 22, 2008, 8:58:28 AM5/22/08
to gwt-maven

Sorry I didn't notice this the first time, but I think your test is
still being run by Surefire because of it's name.

If test names end in "Test" Surefire is going to try to run them, this
stacktrace looks like surefire is involved - surefire can't run GWT
tests. If you name them with the PREFIX "GwtTest" then GWT-Maven will
pick them up. Those are the default settings, there is a
configuration parameter named "testFilter" that sets the "GwtTest"
prefix. If you want to change the prefix you can, but I don't think
it handles anything fancier than a prefix (not a regex, etc).

Tests need to be named differently to distinguish them, gwtTest only
runs the "GwtTest*" named ones, by default.

This is not very well documented, at all, but I have added an issue to
the tracker to update docs for testing stuff (I didn't write the
testing stuff, but I do use it, I will try to update docs when I get a
chance).
Reply all
Reply to author
Forward
0 new messages