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

Andrew Gaul commented on SUREFIRE-1211:
---------------------------------------

The junit option does not give the output I expect.  Consider updating the two 
test classes as follows:

{noformat}
$ cat src/test/java/JunitTest.java 
import org.junit.Test;
public final class JunitTest {
    @Test public void junitMethod() throws Exception {}
    @Test public void junitMethod2() throws Exception {}
}

$ cat src/test/java/TestngTest.java 
import org.testng.annotations.Test;
public final class TestngTest {
    @Test public void testngMethod() throws Exception {}
}
{noformat}

Compare the abridged test output with junit=false:

{noformat}
$ mvn clean test --quiet -Djunit=false
...
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in 
JunitTest
...
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.293 sec - in 
TestSuite
{noformat}

I expect surefire-testng to only run the testng tests (1 test).

Compare the abridged test output with junit=true:

{noformat}
$ mvn clean test --quiet -Djunit=true
...
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.001 sec - in 
JunitTest
...
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.25 sec - in 
TestSuite
{noformat}

I expect surefire-testng to run both the JUnit and testng tests (3 tests).

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

Reply via email to