You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tibor Digana (JIRA)" <ji...@apache.org> on 2015/12/23 22:34:46 UTC

[jira] [Comment Edited] (SUREFIRE-1211) surefire-testng runs JUnit tests

    [ https://issues.apache.org/jira/browse/SUREFIRE-1211?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15070216#comment-15070216 ] 

Tibor Digana edited comment on SUREFIRE-1211 at 12/23/15 9:34 PM:
------------------------------------------------------------------

By default TestNG does not run JUnit tests.
If you do not use the property the Surefire will enable JUnit tests by default, like in TestNG documentation
http://testng.org/doc/documentation-main.html#highlighter_703636
The point of our property is to disable the JUnit tests and not to enable it. For sake of historical reasons in Surefire JUnit was enabled and therefore disabling the JUnit tests within TestNG can be done without breaking backwards compatibility:


{code}
          <properties>
            <property>
              <name>junit</name>
              <value>false</value>
            </property>
          </properties>
{code}



was (Author: tibor17):
By default TestNG does not run JUnit tests.
If you do not use the property the Surefire will enable JUnit tests by default, like in TestNG documentation
http://testng.org/doc/documentation-main.html#highlighter_703636
The point of our property is to disable the JUnit tests and not to enable it. For sake of historical reasons in Surefire JUnit was enabled and therefore disabling the JUnit tests within TestNG can be done without breaking backwards compatibility:

{@code}
          <properties>
            <property>
              <name>junit</name>
              <value>false</value>
            </property>
          </properties>
{@code}


> surefire-testng runs JUnit tests
> --------------------------------
>
>                 Key: SUREFIRE-1211
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1211
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Maven Surefire Plugin
>    Affects Versions: 2.19
>            Reporter: Andrew Gaul
>            Assignee: Tibor Digana
>             Fix For: 2.19.1
>
>         Attachments: pom.xml
>
>
> When running two test classes, one using JUnit and the other testng annotations, I observe surefire-testng running both tests:
> {noformat}
> $ cat src/test/java/JunitTest.java 
> import org.junit.Test;
> public final class JunitTest {
>     @Test public void junitMethod() throws Exception {}
> }
> $ cat src/test/java/TestngTest.java 
> import org.testng.annotations.Test;
> public final class TestngTest {
>     @Test public void testngMethod() throws Exception {}
> }
> $ mvn clean test --quiet
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running JunitTest
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.002 sec - in JunitTest
> Results :
> Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running TestSuite
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.476 sec - in TestSuite
> Results :
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
> {noformat}
> Instead it should only run the single testng test.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)