You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Bulat Nigmatullin (JIRA)" <ji...@codehaus.org> on 2009/10/22 08:48:26 UTC

[jira] Created: (SUREFIRE-579) Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies

Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies
---------------------------------------------------------------------

                 Key: SUREFIRE-579
                 URL: http://jira.codehaus.org/browse/SUREFIRE-579
             Project: Maven Surefire
          Issue Type: Bug
          Components: Junit 4.x support
    Affects Versions: 2.4.3
         Environment: Ubuntu Linux: Linux bcomp 2.6.31-11-generic #36-Ubuntu SMP Fri Sep 25 06:37:51 UTC 2009 i686 GNU/Linux
$ java -version
java version "1.6.0_15"
Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)
$ mvn --version
Apache Maven 2.2.1 (r801777; 2009-08-06 23:16:01+0400)
Java version: 1.6.0_15
Java home: /usr/lib/jvm/java-6-sun-1.6.0.15/jre
Default locale: ru_RU, platform encoding: UTF-8
OS name: "linux" version: "2.6.31-11-generic" arch: "i386" Family: "unix"

            Reporter: Bulat Nigmatullin
            Priority: Minor
         Attachments: sjt.zip

I have a project with a lot of JUnit test. Recently I've added new 
dependency wich have TestNG in it's dependencies. From that moment 
Surefire plugins don't run JUnit test anymore. It seems to me that 
Surefire tries to find TestNG tests but not find them and don't search 
for JUnit tests. Is this behaviour correct and how can i fix this? 

I have the following line in log: 

------------------------------------------------------- 
 T E S T S 
------------------------------------------------------- 
Running TestSuite 
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.117 
sec 

Results : 

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



Example project in attachments.

-- 
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

        

[jira] Commented: (SUREFIRE-579) Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies

Posted by "Jim Showalter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=198018#action_198018 ] 

Jim Showalter commented on SUREFIRE-579:
----------------------------------------

The problem can be fixed for JMockit by upgrading to 0.992, or by adding an exclude to the pom:

            <exclusions>
               <exclusion>
                  <groupId>org.testng</groupId>
                  <artifactId>testng</artifactId>
               </exclusion>
            </exclusions>

In 0.992, all internal JMockit dependencies are marked optional, which causes maven to not transitively add them to the client project.

Should the surefire plugin be adding transitive internal dependencies to the classpath? This could cause problems not just for unit testing.

> Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-579
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-579
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.x support
>    Affects Versions: 2.4.3
>         Environment: Ubuntu Linux: Linux bcomp 2.6.31-11-generic #36-Ubuntu SMP Fri Sep 25 06:37:51 UTC 2009 i686 GNU/Linux
> $ java -version
> java version "1.6.0_15"
> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
> Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)
> $ mvn --version
> Apache Maven 2.2.1 (r801777; 2009-08-06 23:16:01+0400)
> Java version: 1.6.0_15
> Java home: /usr/lib/jvm/java-6-sun-1.6.0.15/jre
> Default locale: ru_RU, platform encoding: UTF-8
> OS name: "linux" version: "2.6.31-11-generic" arch: "i386" Family: "unix"
>            Reporter: Bulat Nigmatullin
>            Priority: Minor
>         Attachments: sjt.zip
>
>
> I have a project with a lot of JUnit test. Recently I've added new 
> dependency wich have TestNG in it's dependencies. From that moment 
> Surefire plugins don't run JUnit test anymore. It seems to me that 
> Surefire tries to find TestNG tests but not find them and don't search 
> for JUnit tests. Is this behaviour correct and how can i fix this? 
> I have the following line in log: 
> ------------------------------------------------------- 
>  T E S T S 
> ------------------------------------------------------- 
> Running TestSuite 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.117 
> sec 
> Results : 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 
> Example project in attachments.

-- 
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

        

[jira] Commented: (SUREFIRE-579) Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies

Posted by "Jim Showalter (JIRA)" <ji...@codehaus.org>.
    [ http://jira.codehaus.org/browse/SUREFIRE-579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=197747#action_197747 ] 

Jim Showalter commented on SUREFIRE-579:
----------------------------------------

We have encountered the same problem, but for JUnit with JMockit.

To reproduce the problem:

1) Sync to the tip of https://code.intuit.com/sf/projects/testutils.

2) In Eclipse, set M2_REPO and JDK_HOME so the .classpath works. (The JDK has to be version 1.6.x.)

3) Manually install version 0.989 of JMockit into M2_REPO/jmockit/jmockit/0.989/jmockit-0.989.jar. (I'm sorry this is a manual step, but the only version of JMockit in the java.net repo is 0.991, and it has the problem we're grappling with.)

4) In the TestUtils directory, run mvn clean install. You will see that 6 tests run with 0 failures and 0 errors.

5) Change the pom.xml dependency on JMockit to:

    <dependency>
      <groupId>mockit</groupId>
      <artifactId>jmockit</artifactId>
      <version>0.991</version>
      <scope>test</scope>
    </dependency>

6) Change the pom.xml javaagent entry to <argLine>-javaagent:"${settings.localRepository}/mockit/jmockit/0.991/jmockit-0.991.jar"</argLine>.

7) Rerun mvn clean install. You will see that 0 tests run with 0 failures and 0 errors. That's the problem--we can't get the tests to run at all when using version 0.991, and there is no other version in the repo.

Removing the javaagent entry has no effect (our understanding is that it should be possible to remove javaagent entirely and still have JMockit initialize correctly).

ErrorCodeUtilsTest is the only test that uses JMockit, so even if JMockit isn't initializing, it seems as if the other five tests should run.

The tests run in Eclipse even if we change the .classpath entry for JMockit to <classpathentry kind="var" path="M2_REPO/mockit/jmockit/0.991/jmockit-0.991.jar"/>.

> Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-579
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-579
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.x support
>    Affects Versions: 2.4.3
>         Environment: Ubuntu Linux: Linux bcomp 2.6.31-11-generic #36-Ubuntu SMP Fri Sep 25 06:37:51 UTC 2009 i686 GNU/Linux
> $ java -version
> java version "1.6.0_15"
> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
> Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)
> $ mvn --version
> Apache Maven 2.2.1 (r801777; 2009-08-06 23:16:01+0400)
> Java version: 1.6.0_15
> Java home: /usr/lib/jvm/java-6-sun-1.6.0.15/jre
> Default locale: ru_RU, platform encoding: UTF-8
> OS name: "linux" version: "2.6.31-11-generic" arch: "i386" Family: "unix"
>            Reporter: Bulat Nigmatullin
>            Priority: Minor
>         Attachments: sjt.zip
>
>
> I have a project with a lot of JUnit test. Recently I've added new 
> dependency wich have TestNG in it's dependencies. From that moment 
> Surefire plugins don't run JUnit test anymore. It seems to me that 
> Surefire tries to find TestNG tests but not find them and don't search 
> for JUnit tests. Is this behaviour correct and how can i fix this? 
> I have the following line in log: 
> ------------------------------------------------------- 
>  T E S T S 
> ------------------------------------------------------- 
> Running TestSuite 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.117 
> sec 
> Results : 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 
> Example project in attachments.

-- 
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

        

[jira] Closed: (SUREFIRE-579) Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies

Posted by "Carlos Sanchez (JIRA)" <ji...@codehaus.org>.
     [ http://jira.codehaus.org/browse/SUREFIRE-579?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Carlos Sanchez closed SUREFIRE-579.
-----------------------------------

    Resolution: Duplicate

See SUREFIRE-377

> Maven Surefire Plugin don't run JUnit tests if TestNG in dependencies
> ---------------------------------------------------------------------
>
>                 Key: SUREFIRE-579
>                 URL: http://jira.codehaus.org/browse/SUREFIRE-579
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.x support
>    Affects Versions: 2.4.3
>         Environment: Ubuntu Linux: Linux bcomp 2.6.31-11-generic #36-Ubuntu SMP Fri Sep 25 06:37:51 UTC 2009 i686 GNU/Linux
> $ java -version
> java version "1.6.0_15"
> Java(TM) SE Runtime Environment (build 1.6.0_15-b03)
> Java HotSpot(TM) Server VM (build 14.1-b02, mixed mode)
> $ mvn --version
> Apache Maven 2.2.1 (r801777; 2009-08-06 23:16:01+0400)
> Java version: 1.6.0_15
> Java home: /usr/lib/jvm/java-6-sun-1.6.0.15/jre
> Default locale: ru_RU, platform encoding: UTF-8
> OS name: "linux" version: "2.6.31-11-generic" arch: "i386" Family: "unix"
>            Reporter: Bulat Nigmatullin
>            Priority: Minor
>         Attachments: sjt.zip
>
>
> I have a project with a lot of JUnit test. Recently I've added new 
> dependency wich have TestNG in it's dependencies. From that moment 
> Surefire plugins don't run JUnit test anymore. It seems to me that 
> Surefire tries to find TestNG tests but not find them and don't search 
> for JUnit tests. Is this behaviour correct and how can i fix this? 
> I have the following line in log: 
> ------------------------------------------------------- 
>  T E S T S 
> ------------------------------------------------------- 
> Running TestSuite 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.117 
> sec 
> Results : 
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0 
> Example project in attachments.

-- 
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