You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Kristian Rosenvold (JIRA)" <ji...@codehaus.org> on 2011/01/12 18:38:58 UTC

[jira] Updated: (SUREFIRE-563) Tests does not behave like in Eclipse

     [ http://jira.codehaus.org/browse/SUREFIRE-563?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Rosenvold updated SUREFIRE-563:
----------------------------------------

    Issue Type: Wish  (was: Bug)

> Tests does not behave like in Eclipse
> -------------------------------------
>
>                 Key: SUREFIRE-563
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-563
>             Project: Maven Surefire
>          Issue Type: Wish
>          Components: Junit 4.x support
>    Affects Versions: 2.0 (2.2 plugin)
>         Environment: Ubuntu 8.10
>            Reporter: Rodrigo Benenson
>         Attachments: mavenbug.zip
>
>
> I have a test code that behave differently between "mvn test" and Eclipse.
> The setup:
> See attached files MavenBug2Spec and MavenBaseBug2Spec. I use JDave to write the tests.
> http://www.jdave.org/
> MavenBug2Spec extends MavenBaseBug2Spec<String>
> The problem:
> When running in Eclipse MavenBug2Spec will run two tests as expected:
> MavenBug2Spec -> SimpleTest -> endCheck()
> and 
> MavenBug2Spec -> SimpleTest -> BaseTest -> AbstractTest -> nonNullCheck()
> When running "mvn clean test" only one test is called:
> MavenBug2Spec -> SimpleTest -> endCheck()
> the method
> MavenBug2Spec -> SimpleTest -> BaseTest -> AbstractTest -> nonNullCheck()
> is not considered part of the test (as it should).
> Workaround:
> After hours and hours of inspection I found the following workaround.
> The class MavenBaseBug2Spec<T>.AbstractTest is declared
> 	protected abstract class AbstractTest 
> which is valid Java code, changing this to
> 	public abstract class AbstractTest 
>  will fix the ill behaviour in mvn
> Of course this is an ugly workaround that makes AbstractTest more permissive than it should.
> Hint:
> The issue seems to be related to the compilation process (I can compile under Eclipse and it will run fine in mvn, I can compile under mvn and the test will not run ok in Eclipse)
> I hope someone will fix this issue. I admit the use case is tricky, but for me it was very very disturbing to discover that two identical java source code compiled with the same java compiler, using the same junit library can behave in two different ways. I still have no idea of what makes the compilation from Eclipse different from Maven. The eclipse project is created from the pom file (with mvn eclipse:eclipse). 
> Regards,
> rodrigob.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira