maven2 unit testing

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

maven2 unit testing

Dieter Houthooft
Hi,

my maven2 job in hudson (1.143) fails to execute my unit tests. There  
are two things about this:
* A maven2 build as a shell command in a custom Hudson project works  
perfectly
* The test failure does not mark the build as broken, nor does it  
record the failure.

Is this a known hudson configuration issue? I could not find anything  
in the manual or mailinglist. Or do I create a hudson issue?

best regards,
Dieter.

Maven2 job console output:

[INFO] Building jar: /tmp/surefirebooter49497.jar
org.apache.maven.surefire.booter.SurefireExecutionException: Unable  
to create test class 'xxx.SomeBeanTest'; nested exception is  
java.lang.ClassNotFoundException: xxx.SomeBeanTest; nested exception  
is org.apache.maven.surefire.testset.TestSetFailedException: Unable  
to create test class 'xxx.SomeBeanTest'; nested exception is  
java.lang.ClassNotFoundException: xxx.SomeBeanTest
org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
create test class 'xxx.SomeBeanTest'; nested exception is  
java.lang.ClassNotFoundException: xxx.SomeBeanTest
java.lang.ClassNotFoundException: xxx.SomeBeanTest
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
        at  
org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSet
s(AbstractDirectoryTestSuite.java:87)
        at org.apache.maven.surefire.Surefire.createSuiteFromDefinition
(Surefire.java:150)
        at org.apache.maven.surefire.Surefire.run(Surefire.java:67)
        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:585)
        at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
(SurefireBooter.java:244)
        at org.apache.maven.surefire.booter.SurefireBooter.main
(SurefireBooter.java:814)
[ERROR] There are test failures.
[HUDSON] Recording test results

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: maven2 unit testing

Kohsuke Kawaguchi
Administrator
Dieter Houthooft wrote:

> Hi,
>
> my maven2 job in hudson (1.143) fails to execute my unit tests. There  
> are two things about this:
> * A maven2 build as a shell command in a custom Hudson project works  
> perfectly
> * The test failure does not mark the build as broken, nor does it  
> record the failure.
>
> Is this a known hudson configuration issue? I could not find anything  
> in the manual or mailinglist. Or do I create a hudson issue?
Hmm. Any chance you can paste the whole build log from beginning to the
end? If this is by any chance an open source project that we can build
here (to reproduce the problem), that would make this even easier.



> best regards,
> Dieter.
>
> Maven2 job console output:
>
> [INFO] Building jar: /tmp/surefirebooter49497.jar
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable  
> to create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest; nested exception  
> is org.apache.maven.surefire.testset.TestSetFailedException: Unable  
> to create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
> create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> at  
> org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.locateTestSet
> s(AbstractDirectoryTestSuite.java:87)
> at org.apache.maven.surefire.Surefire.createSuiteFromDefinition
> (Surefire.java:150)
> at org.apache.maven.surefire.Surefire.run(Surefire.java:67)
> 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:585)
> at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess
> (SurefireBooter.java:244)
> at org.apache.maven.surefire.booter.SurefireBooter.main
> (SurefireBooter.java:814)
> [ERROR] There are test failures.
> [HUDSON] Recording test results

--
Kohsuke Kawaguchi
Sun Microsystems                   [hidden email]

smime.p7s (4K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: maven2 unit testing

Dieter Houthooft

On 27 Sep 2007, at 02:30, Kohsuke Kawaguchi wrote:

> Dieter Houthooft wrote:
>> Hi,
>> my maven2 job in hudson (1.143) fails to execute my unit tests.  
>> There  are two things about this:
>> * A maven2 build as a shell command in a custom Hudson project  
>> works  perfectly
>> * The test failure does not mark the build as broken, nor does it  
>> record the failure.
>> Is this a known hudson configuration issue? I could not find  
>> anything  in the manual or mailinglist. Or do I create a hudson  
>> issue?
>
> Hmm. Any chance you can paste the whole build log from beginning to  
> the end? If this is by any chance an open source project that we  
> can build here (to reproduce the problem), that would make this  
> even easier.
I can`t do this, but if I succeed in isolating the problem in a dummy  
maven2 project I will post it.

thanks.
Dieter.

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: maven2 unit testing

Dieter Houthooft
In reply to this post by Dieter Houthooft
On 26 Sep 2007, at 09:58, Dieter Houthooft wrote:

> my maven2 job in hudson (1.143) fails to execute my unit tests.  
> There are two things about this:
> * A maven2 build as a shell command in a custom Hudson project  
> works perfectly
> * The test failure does not mark the build as broken, nor does it  
> record the failure.
>
> Maven2 job console output:
>
> [INFO] Building jar: /tmp/surefirebooter49497.jar
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable  
> to create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest; nested  
> exception is  
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
> create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
> create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
I found the cause of this problem. It is combination of 2 settings:

1. configuration of the surefire plugin to use the system class loader:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3</version>
<configuration>
        <forkMode>always</forkMode>
        <useSystemClassLoader>true</useSystemClassLoader>
</configuration>

2. The hudson job had whitespace in its name.

cheers,
Dieter.

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: maven2 unit testing

Jesse Glick
Dieter Houthooft wrote:
> 2. The hudson job had whitespace in its name.

Does it also fail when run from the command line inside a checkout with
a space in its pathname? If so, a Maven bug.

-J.

--
[hidden email]  netbeans.org  ant.apache.org  hudson.dev.java.net
             http://google.com/search?q=e%5E%28pi*i%29%2B1

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: maven2 unit testing

jblack
In reply to this post by Dieter Houthooft
Spaces in *nix directory path to a maven project is a known issue with surefire plugin v2.4-SNAPSHOT:  
http://jira.codehaus.org/browse/SUREFIRE-359

Jeff

Dieter Houthooft wrote
On 26 Sep 2007, at 09:58, Dieter Houthooft wrote:

> my maven2 job in hudson (1.143) fails to execute my unit tests.  
> There are two things about this:
> * A maven2 build as a shell command in a custom Hudson project  
> works perfectly
> * The test failure does not mark the build as broken, nor does it  
> record the failure.
>
> Maven2 job console output:
>
> [INFO] Building jar: /tmp/surefirebooter49497.jar
> org.apache.maven.surefire.booter.SurefireExecutionException: Unable  
> to create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest; nested  
> exception is  
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
> create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> org.apache.maven.surefire.testset.TestSetFailedException: Unable to  
> create test class 'xxx.SomeBeanTest'; nested exception is  
> java.lang.ClassNotFoundException: xxx.SomeBeanTest
> java.lang.ClassNotFoundException: xxx.SomeBeanTest

I found the cause of this problem. It is combination of 2 settings:

1. configuration of the surefire plugin to use the system class loader:

<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.3</version>
<configuration>
        <forkMode>always</forkMode>
        <useSystemClassLoader>true</useSystemClassLoader>
</configuration>

2. The hudson job had whitespace in its name.

cheers,
Dieter.