You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by ti...@apache.org on 2020/05/02 21:35:44 UTC

[maven-surefire] branch SUREFIRE-1787 updated (0ef05ba -> 5975edd)

This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a change to branch SUREFIRE-1787
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.


 discard 0ef05ba  [SUREFIRE-1787] Support multiple runners (JUnit4, TestNG, other) and their API in JUnit5 Provider
     new 5975edd  [SUREFIRE-1787] Support multiple runners (JUnit4, TestNG, other) and their API in JUnit5 Provider

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (0ef05ba)
            \
             N -- N -- N   refs/heads/SUREFIRE-1787 (5975edd)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 surefire-its/src/test/resources/junit5-runner/pom.xml | 7 -------
 1 file changed, 7 deletions(-)


[maven-surefire] 01/01: [SUREFIRE-1787] Support multiple runners (JUnit4, TestNG, other) and their API in JUnit5 Provider

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

tibordigana pushed a commit to branch SUREFIRE-1787
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git

commit 5975eddc1bdbe127740df40dbb9871085e078633
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat May 2 13:08:16 2020 +0200

    [SUREFIRE-1787] Support multiple runners (JUnit4, TestNG, other) and their API in JUnit5 Provider
    
    (cherry picked from commit 4eec1d93a10304d9661b26f272a5bb147199bca1)
---
 .../plugin/surefire/AbstractSurefireMojo.java      | 106 +++++++--------
 surefire-its/src/test/resources/junit-4-5/pom.xml  | 146 +++++++++++++++++++++
 .../junit-4-5/src/test/java/pkg/JUnit4Test.java    |  10 ++
 .../junit-4-5/src/test/java/pkg/JUnit5Test.java    |  10 ++
 .../src/test/resources/junit5-runner/pom.xml       |  46 +++++++
 .../src/test/java/examples/RootTest.java           |  10 ++
 .../src/test/java/examples/a/ATest.java            |  10 ++
 .../src/test/java/examples/b/BTest.java            |  10 ++
 .../src/test/java/pkg/JUnit5Tests.java             |  15 +++
 .../src/test/resources/junit5-testng/pom.xml       |  74 +++++++++++
 .../src/test/java/pkg/JUnit5Test.java              |  10 ++
 .../src/test/java/pkg/TestNGTest.java              |  10 ++
 12 files changed, 400 insertions(+), 57 deletions(-)

diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
index 6fd5df4..055eff0 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/AbstractSurefireMojo.java
@@ -1173,8 +1173,8 @@ public abstract class AbstractSurefireMojo
     {
         Artifact junitDepArtifact = getJunitDepArtifact();
         return new ProviderList( new DynamicProviderInfo( null ),
+                              new JUnitPlatformProviderInfo( getJUnit5Artifact(), testClasspath ),
                               new TestNgProviderInfo( getTestNgArtifact() ),
-                              new JUnitPlatformProviderInfo( getJunitPlatformArtifact(), testClasspath ),
                               new JUnitCoreProviderInfo( getJunitArtifact(), junitDepArtifact ),
                               new JUnit4ProviderInfo( getJunitArtifact(), junitDepArtifact ),
                               new JUnit3ProviderInfo() )
@@ -2308,21 +2308,17 @@ public abstract class AbstractSurefireMojo
         return getProjectArtifactMap().get( "junit:junit-dep" );
     }
 
-    private Artifact getJunitPlatformArtifact()
+    private Artifact getJUnit5Artifact()
     {
-        Artifact artifact = getProjectArtifactMap().get( "org.junit.platform:junit-platform-commons" );
-        if ( artifact == null )
+        if ( getProjectArtifactMap().get( "org.junit.platform:junit-platform-runner" ) != null )
         {
-            artifact = getPluginArtifactMap().get( "org.junit.platform:junit-platform-engine" );
+            return null;
         }
 
-        Artifact projectArtifact = project.getArtifact();
-        String projectGroupId = projectArtifact.getGroupId();
-        if ( artifact == null && ( "org.junit.platform".equals( projectGroupId )
-                || "org.junit.jupiter".equals( projectGroupId )
-                || "org.junit.vintage".equals( projectGroupId ) ) )
+        Artifact artifact = getPluginArtifactMap().get( "org.junit.platform:junit-platform-engine" );
+        if ( artifact == null )
         {
-            artifact = projectArtifact;
+            artifact = getProjectArtifactMap().get( "org.junit.platform:junit-platform-commons" );
         }
 
         return artifact;
@@ -2890,7 +2886,7 @@ public abstract class AbstractSurefireMojo
             {
                 Artifact junitArtifact = getJunitArtifact();
                 boolean junit47Compatible = isJunit47Compatible( junitArtifact );
-                boolean junit5PlatformCompatible = getJunitPlatformArtifact() != null;
+                boolean junit5PlatformCompatible = getJUnit5Artifact() != null;
                 if ( !junit47Compatible && !junit5PlatformCompatible )
                 {
                     if ( junitArtifact != null )
@@ -3142,24 +3138,19 @@ public abstract class AbstractSurefireMojo
                     surefireDependencyResolver.getProviderClasspathAsMap( "surefire-junit-platform", surefireVersion );
             Map<String, Artifact> testDependencies = testClasspath.getTestDependencies();
 
-            if ( hasDependencyPlatformEngine( testDependencies ) )
+            ProjectBuildingRequest request = getSession().getProjectBuildingRequest();
+            Plugin plugin = getPluginDescriptor().getPlugin();
+            Set<Artifact> engines = surefireDependencyResolver.resolvePluginDependencies( request, plugin );
+
+            // tymto sa len zarovna verzia junit-platform-launcher z classpathu providera
+            if ( hasDependencyPlatformEngine( engines ) )
             {
-                String filterTestDependency = "org.junit.platform:junit-platform-engine";
-                getConsoleLogger().debug( "Test dependencies contain " + filterTestDependency );
-                narrowProviderDependencies( filterTestDependency, providerArtifacts, testDependencies );
+                Map<String, Artifact> engineArtifacts = artifactMapByVersionlessId( engines );
+                providerArtifacts.putAll( engineArtifacts );
             }
             else
             {
-                ProjectBuildingRequest request = getSession().getProjectBuildingRequest();
-                Plugin plugin = getPluginDescriptor().getPlugin();
-                Set<Artifact> engines = surefireDependencyResolver.resolvePluginDependencies( request, plugin );
-                if ( hasDependencyPlatformEngine( engines ) )
-                {
-                    Map<String, Artifact> engineArtifacts = artifactMapByVersionlessId( engines );
-                    providerArtifacts.putAll( engineArtifacts );
-                    alignVersions( providerArtifacts, engineArtifacts );
-                }
-                else if ( hasDependencyJupiterAPI( testDependencies ) )
+                if ( hasDependencyJupiterAPI( testDependencies ) )
                 {
                     String engineGroupId = "org.junit.jupiter";
                     String engineArtifactId = "junit-jupiter-engine";
@@ -3167,52 +3158,47 @@ public abstract class AbstractSurefireMojo
                     String api = "org.junit.jupiter:junit-jupiter-api";
                     getConsoleLogger().debug( "Test dependencies contain " + api + ". Resolving " + engineCoordinates );
                     String engineVersion = testDependencies.get( api ).getBaseVersion();
-                    addEngineByApi( engineGroupId, engineArtifactId, engineVersion,
-                            providerArtifacts, testDependencies );
+                    addEngineByApi( engineGroupId, engineArtifactId, engineVersion, providerArtifacts );
+                }
+
+                if ( testDependencies.containsKey( "junit:junit" )
+                    || testDependencies.containsKey( "junit:junit-dep" ) )
+                {
+                    String engineGroupId = "org.junit.vintage";
+                    String engineArtifactId = "junit-vintage-engine";
+                    String engineCoordinates = engineGroupId + ":" + engineArtifactId;
+                    String api = "org.junit.jupiter:junit-jupiter-api";
+                    getConsoleLogger().debug( "Test dependencies contain JUnit4. Resolving " + engineCoordinates );
+                    String engineVersion = testDependencies.get( api ).getBaseVersion();
+                    addEngineByApi( engineGroupId, engineArtifactId, engineVersion, providerArtifacts );
                 }
             }
-            providerArtifacts.keySet().removeAll( testDependencies.keySet() );
+
+            narrowDependencies( providerArtifacts, testDependencies );
+            alignProviderVersions( providerArtifacts );
+
             return new LinkedHashSet<>( providerArtifacts.values() );
         }
 
         private void addEngineByApi( String engineGroupId, String engineArtifactId, String engineVersion,
-                                     Map<String, Artifact> providerArtifacts, Map<String, Artifact> testDependencies )
+                                     Map<String, Artifact> providerArtifacts )
         {
-            providerArtifacts.keySet().removeAll( testDependencies.keySet() );
             for ( Artifact dep : resolve( engineGroupId, engineArtifactId, engineVersion, null, "jar" ) )
             {
                 String key = dep.getGroupId() + ":" + dep.getArtifactId();
-                if ( !testDependencies.containsKey( key ) )
-                {
-                    providerArtifacts.put( key, dep );
-                }
+                providerArtifacts.put( key, dep );
             }
-            alignVersions( providerArtifacts, testDependencies );
         }
 
-        private void narrowProviderDependencies( String filterTestDependency,
-                                                 Map<String, Artifact> providerArtifacts,
-                                                 Map<String, Artifact> testDependencies )
+        private void narrowDependencies( Map<String, Artifact> providerArtifacts,
+                                         Map<String, Artifact> testDependencies )
         {
-            Artifact engine = testDependencies.get( filterTestDependency );
-            String groupId = engine.getGroupId();
-            String artifactId = engine.getArtifactId();
-            String version = engine.getBaseVersion();
-            String classifier = engine.getClassifier();
-            String type = engine.getType();
-            for ( Artifact engineDep : resolve( groupId, artifactId, version, classifier, type ) )
-            {
-                providerArtifacts.remove( engineDep.getGroupId() + ":" + engineDep.getArtifactId() );
-                getConsoleLogger().debug( "Removed artifact " + engineDep
-                        + " from provider. Already appears in test classpath." );
-            }
-            alignVersions( providerArtifacts, testDependencies );
+            providerArtifacts.keySet().removeAll( testDependencies.keySet() );
         }
 
-        private void alignVersions( Map<String, Artifact> providerArtifacts,
-                                    Map<String, Artifact> referencedDependencies )
+        private void alignProviderVersions( Map<String, Artifact> providerArtifacts )
         {
-            String version = referencedDependencies.get( "org.junit.platform:junit-platform-commons" ).getBaseVersion();
+            String version = junitPlatformArtifact.getBaseVersion();
             for ( Artifact launcherArtifact : resolve( PROVIDER_DEP_GID, PROVIDER_DEP_AID, version, null, "jar" ) )
             {
                 String key = launcherArtifact.getGroupId() + ":" + launcherArtifact.getArtifactId();
@@ -3233,6 +3219,12 @@ public abstract class AbstractSurefireMojo
             return r;
         }
 
+        private boolean hasDependencyVintageEngine( Map<String, Artifact> dependencies )
+        {
+            return dependencies.containsKey( "org.junit.vintage:junit-vintage-engine" )
+                || hasGroupArtifactId( "org.junit.vintage", "junit-vintage-engine", getProject().getArtifact() );
+        }
+
         private boolean hasDependencyJupiterAPI( Map<String, Artifact> dependencies )
         {
             return dependencies.containsKey( "org.junit.jupiter:junit-jupiter-api" )
@@ -3389,10 +3381,10 @@ public abstract class AbstractSurefireMojo
                 logDebugOrCliShowErrors( "Using configured provider " + providerToAdd.getProviderName() );
                 providersToRun.add( providerToAdd );
             }
-            return manuallyConfiguredProviders.isEmpty() ? autoDetectOneProvider() : providersToRun;
+            return manuallyConfiguredProviders.isEmpty() ? autoDetectOneWellKnownProvider() : providersToRun;
         }
 
-        @Nonnull private List<ProviderInfo> autoDetectOneProvider()
+        @Nonnull private List<ProviderInfo> autoDetectOneWellKnownProvider()
         {
             List<ProviderInfo> providersToRun = new ArrayList<>();
             for ( ProviderInfo wellKnownProvider : wellKnownProviders )
diff --git a/surefire-its/src/test/resources/junit-4-5/pom.xml b/surefire-its/src/test/resources/junit-4-5/pom.xml
new file mode 100644
index 0000000..7173eb1
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-4-5/pom.xml
@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.example</groupId>
+    <artifactId>junit-4-5</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <properties>
+        <maven.compiler.testSource>1.8</maven.compiler.testSource>
+        <maven.compiler.testTarget>1.8</maven.compiler.testTarget>
+    </properties>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>3.0.0-SNAPSHOT</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>both-engines</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-engine</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>api-and-engines</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-api</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>both-api</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-api</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                    <version>4.13</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>select-junit4</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-api</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                    <version>4.13</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.junit.vintage</groupId>
+                                <artifactId>junit-vintage-engine</artifactId>
+                                <version>5.6.2</version>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>select-junit5</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-api</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+                <dependency>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                    <version>4.13</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <dependencies>
+                            <dependency>
+                                <groupId>org.junit.jupiter</groupId>
+                                <artifactId>junit-jupiter-engine</artifactId>
+                                <version>5.6.2</version>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+
+</project>
\ No newline at end of file
diff --git a/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit4Test.java b/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit4Test.java
new file mode 100644
index 0000000..04c7f99
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit4Test.java
@@ -0,0 +1,10 @@
+package pkg;
+
+import org.junit.Test;
+
+public class JUnit4Test {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit5Test.java b/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit5Test.java
new file mode 100644
index 0000000..916eeab
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-4-5/src/test/java/pkg/JUnit5Test.java
@@ -0,0 +1,10 @@
+package pkg;
+
+import org.junit.jupiter.api.Test;
+
+class JUnit5Test {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit5-runner/pom.xml b/surefire-its/src/test/resources/junit5-runner/pom.xml
new file mode 100644
index 0000000..a8eff6c
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-runner/pom.xml
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.example</groupId>
+    <artifactId>junit5-runner</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <properties>
+        <maven.compiler.testSource>1.8</maven.compiler.testSource>
+        <maven.compiler.testTarget>1.8</maven.compiler.testTarget>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.junit.jupiter</groupId>
+            <artifactId>junit-jupiter-engine</artifactId>
+            <version>5.6.2</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.junit.platform</groupId>
+            <artifactId>junit-platform-runner</artifactId>
+            <version>1.6.2</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>3.0.0-SNAPSHOT</version>
+                    <configuration>
+                        <test>JUnit5Tests</test>
+                    </configuration>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+</project>
diff --git a/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/RootTest.java b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/RootTest.java
new file mode 100644
index 0000000..74928ec
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/RootTest.java
@@ -0,0 +1,10 @@
+package examples;
+
+import org.junit.Test;
+
+class RootTest {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/a/ATest.java b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/a/ATest.java
new file mode 100644
index 0000000..620f932
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/a/ATest.java
@@ -0,0 +1,10 @@
+package examples.a;
+
+import org.junit.Test;
+
+public class ATest {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/b/BTest.java b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/b/BTest.java
new file mode 100644
index 0000000..3a36713
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-runner/src/test/java/examples/b/BTest.java
@@ -0,0 +1,10 @@
+package examples.b;
+
+import org.junit.Test;
+
+public class BTest {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit5-runner/src/test/java/pkg/JUnit5Tests.java b/surefire-its/src/test/resources/junit5-runner/src/test/java/pkg/JUnit5Tests.java
new file mode 100644
index 0000000..4f2788a
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-runner/src/test/java/pkg/JUnit5Tests.java
@@ -0,0 +1,15 @@
+package pkg;
+
+import org.junit.platform.runner.JUnitPlatform;
+import org.junit.platform.suite.api.ExcludeTags;
+import org.junit.platform.suite.api.IncludePackages;
+import org.junit.platform.suite.api.SelectPackages;
+import org.junit.runner.RunWith;
+
+@RunWith(JUnitPlatform.class)
+@SelectPackages("examples")
+@IncludePackages("examples.a")
+@ExcludeTags("PROD")
+public class JUnit5Tests {
+
+}
diff --git a/surefire-its/src/test/resources/junit5-testng/pom.xml b/surefire-its/src/test/resources/junit5-testng/pom.xml
new file mode 100644
index 0000000..6bf6829
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-testng/pom.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.example</groupId>
+    <artifactId>testng-junit5</artifactId>
+    <version>1.0-SNAPSHOT</version>
+
+    <properties>
+        <maven.compiler.testSource>1.8</maven.compiler.testSource>
+        <maven.compiler.testTarget>1.8</maven.compiler.testTarget>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.testng</groupId>
+            <artifactId>testng</artifactId>
+            <version>7.1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>com.github.testng-team</groupId>
+            <artifactId>testng-junit5</artifactId>
+            <version>0.0.1</version>
+            <scope>test</scope>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.junit.platform</groupId>
+                    <artifactId>junit-platform-engine</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-surefire-plugin</artifactId>
+                    <version>3.0.0-SNAPSHOT</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+    </build>
+
+    <profiles>
+        <profile>
+            <id>both-engines</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-engine</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>both-api</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.jupiter</groupId>
+                    <artifactId>junit-jupiter-api</artifactId>
+                    <version>5.6.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
+</project>
diff --git a/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/JUnit5Test.java b/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/JUnit5Test.java
new file mode 100644
index 0000000..916eeab
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/JUnit5Test.java
@@ -0,0 +1,10 @@
+package pkg;
+
+import org.junit.jupiter.api.Test;
+
+class JUnit5Test {
+    @Test
+    public void test() {
+
+    }
+}
diff --git a/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/TestNGTest.java b/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/TestNGTest.java
new file mode 100644
index 0000000..5b2443d
--- /dev/null
+++ b/surefire-its/src/test/resources/junit5-testng/src/test/java/pkg/TestNGTest.java
@@ -0,0 +1,10 @@
+package pkg;
+
+import org.testng.annotations.Test;
+
+public class TestNGTest {
+    @Test
+    public void test() {
+
+    }
+}