diff --git a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm index e1426a680a..ea882af9cc 100644 --- a/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm +++ b/maven-surefire-plugin/src/site/apt/examples/junit-platform.apt.vm @@ -79,7 +79,6 @@ Using JUnit 5 Platform JUnit5 API artifact and your test sources become isolated from engine. In these chapters you will see how you can segregate, combine, select the APIs and Engines miscellaneous way. You can find integration tests {{{https://github.com/apache/maven-surefire/tree/master/surefire-its/src/test/resources/junit-4-5}with JUnit4/5}}, - {{{https://github.com/apache/maven-surefire/tree/master/surefire-its/src/test/resources/junit5-testng}with JUnit5/TestNG}} and {{{https://github.com/apache/maven-surefire/tree/master/surefire-its/src/test/resources/junit5-runner}with the JUnit4 Runner for Jupiter tests}}. (See the Maven profiles.) @@ -347,37 +346,32 @@ Using JUnit 5 Platform +---+ -** How to run TestNG tests within Jupiter engine +** How to run TestNG tests within the JUnit Platform You can run TestNG tests combined with JUnit5 tests. For more information see this - {{{https://github.com/apache/maven-surefire/tree/master/surefire-its/src/test/resources/junit5-testng}example}}. + {{{https://github.com/junit-team/testng-engine}TestNG Engine for the JUnit Platform}}. +---+ + org.testng testng - 7.1.0 + 7.4.0 test - com.github.testng-team - testng-junit5 - 0.0.1 + org.junit.support + testng-engine + 1.0.1 test - - - org.junit.platform - junit-platform-engine - - org.junit.jupiter junit-jupiter-api - 5.6.2 + 5.8.2 test diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1787JUnit5IT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1787JUnit5IT.java index 3e7e056b53..b501404501 100644 --- a/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1787JUnit5IT.java +++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/jiras/Surefire1787JUnit5IT.java @@ -93,6 +93,17 @@ public void selectJUnit5() "Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider" ); } + @Test + public void testNgOnlyWithJUnitPlatform() + { + unpack( "junit5-testng-only" ) + .executeTest() + .verifyErrorFree( 1 ) + .verifyTextInLog( "Running pkg.TestNGTest" ) + .verifyTextInLog( + "Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider" ); + } + @Test public void testNgWithJupiterApi() { @@ -104,7 +115,6 @@ public void testNgWithJupiterApi() .verifyTextInLog( "Running pkg.TestNGTest" ) .verifyTextInLog( "Using auto detected provider org.apache.maven.surefire.junitplatform.JUnitPlatformProvider" ); - } @Test diff --git a/surefire-its/src/test/resources/junit5-testng-only/pom.xml b/surefire-its/src/test/resources/junit5-testng-only/pom.xml new file mode 100644 index 0000000000..5dfbbaa4ff --- /dev/null +++ b/surefire-its/src/test/resources/junit5-testng-only/pom.xml @@ -0,0 +1,65 @@ + + + + + 4.0.0 + + org.example + testng-only-junit5 + 1.0-SNAPSHOT + + Project with only TestNG tests executed by JUnit Platform + + + UTF-8 + ${java.specification.version} + ${java.specification.version} + + + + + org.testng + testng + 7.4.0 + test + + + org.junit.support + testng-engine + 1.0.1 + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + + + + + diff --git a/surefire-its/src/test/resources/junit5-testng-only/src/test/java/pkg/TestNGTest.java b/surefire-its/src/test/resources/junit5-testng-only/src/test/java/pkg/TestNGTest.java new file mode 100644 index 0000000000..5b2443d393 --- /dev/null +++ b/surefire-its/src/test/resources/junit5-testng-only/src/test/java/pkg/TestNGTest.java @@ -0,0 +1,10 @@ +package pkg; + +import org.testng.annotations.Test; + +public class TestNGTest { + @Test + public void test() { + + } +} diff --git a/surefire-its/src/test/resources/junit5-testng/pom.xml b/surefire-its/src/test/resources/junit5-testng/pom.xml index c18e4649c6..2f8cf9d5ab 100644 --- a/surefire-its/src/test/resources/junit5-testng/pom.xml +++ b/surefire-its/src/test/resources/junit5-testng/pom.xml @@ -21,74 +21,74 @@ - 4.0.0 + 4.0.0 - org.example - testng-junit5 - 1.0-SNAPSHOT + org.example + testng-junit5 + 1.0-SNAPSHOT - - UTF-8 - ${java.specification.version} - ${java.specification.version} - + Project with mixed TestNG and JUnit5 tests. - + + UTF-8 + ${java.specification.version} + ${java.specification.version} + + + + + org.testng + testng + 7.4.0 + test + + + org.junit.support + testng-engine + 1.0.1 + test + + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + ${surefire.version} + + + + + + + + junit5-engine + - org.testng - testng - 7.1.0 - test + org.junit.jupiter + junit-jupiter-engine + + + 5.7.2 + test + + + + junit5-api + - com.github.testng-team - testng-junit5 - 0.0.1 - test - - - org.junit.platform - junit-platform-engine - - + org.junit.jupiter + junit-jupiter-api + + + 5.8.2 + test - - - - - - - org.apache.maven.plugins - maven-surefire-plugin - ${surefire.version} - - - - - - - - junit5-engine - - - org.junit.jupiter - junit-jupiter-engine - 5.6.2 - test - - - - - junit5-api - - - org.junit.jupiter - junit-jupiter-api - 5.6.2 - test - - - - + + +