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 2019/12/01 03:30:00 UTC

[maven-surefire] branch junit5-runorder updated (1bd8c4d -> 8b89ca9)

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

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


 discard 1bd8c4d  Run Order / JUnit5 supported in the Feature Matrix + tests
 discard f7f928e  Run Order / JUnit5 supported in the Feature Matrix + tests
     add 706346f  [SUREFIRE-1728] maven.test.failure.ignore: differentiate between test failure and timeout
     new 8b89ca9  Run Order / JUnit5 supported in the Feature Matrix + tests

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   (1bd8c4d)
            \
             N -- N -- N   refs/heads/junit5-runorder (8b89ca9)

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:
 .../main/java/org/apache/maven/plugin/surefire/SurefireHelper.java    | 2 +-
 maven-surefire-plugin/src/site/apt/examples/shutdown.apt.vm           | 2 +-
 .../maven/surefire/its/jiras/Surefire705ParallelForkTimeoutIT.java    | 2 +-
 .../surefire/its/jiras/Surefire920TestFailureIgnoreWithTimeoutIT.java | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)


[maven-surefire] 01/01: Run Order / JUnit5 supported in the Feature Matrix + tests

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

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

commit 8b89ca9e3a0113e71e2e41589caa291603b0f37e
Author: tibordigana <ti...@apache.org>
AuthorDate: Sun Dec 1 03:22:35 2019 +0100

    Run Order / JUnit5 supported in the Feature Matrix + tests
---
 .../src/site/apt/featurematrix.apt.vm              |  3 +-
 .../org/apache/maven/surefire/its/RunOrderIT.java  | 87 ++++++++++++++++++----
 surefire-its/src/test/resources/runOrder/pom.xml   | 34 ++++++---
 3 files changed, 98 insertions(+), 26 deletions(-)

diff --git a/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm b/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
index 05d13bc..0cd4c38 100644
--- a/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
@@ -34,7 +34,7 @@ Feature Matrix
 *---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
 | security manager support                    |     Y      |    N     |      N     |    N      |  N       |  N                   |
 *---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
-| runOrder support                            |     Y      |    Y     |      Y     |    ?      |  Y       |  N                   |
+| runOrder support                            |     Y      |    Y     |      Y     |    ?      |  Y       |  Y                   |
 *---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
 | run >1 individual test method in a class    |     N      |    Y     |      Y     |    Y      |  N       |  ?(*1)               |
 *---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
@@ -63,4 +63,3 @@ Feature Matrix
    (*2) 3 extensions related to JUnit5 annotation <<<DisplayName>>>.
 
    (*3) Since 3.0.0-M4
-   
\ No newline at end of file
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
index d2031fa..5d3f2f3 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/RunOrderIT.java
@@ -26,6 +26,8 @@ import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.apache.maven.surefire.its.fixture.SurefireLauncher;
 import org.junit.Test;
 
+import static org.apache.maven.surefire.its.fixture.HelperAssertions.assumeJavaVersion;
+
 /**
  * Verifies the runOrder setting and its effect
  *
@@ -41,27 +43,45 @@ public class RunOrderIT
     // testing random is left as an exercise to the reader. Patches welcome
 
     @Test
-    public void testAlphabetical()
+    public void testAlphabeticalJUnit4()
+        throws Exception
+    {
+        OutputValidator validator = executeWithRunOrder( "alphabetical", "junit4" );
+        assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_ALPHABETICAL_ORDER );
+    }
+
+    @Test
+    public void testAlphabeticalJUnit5()
         throws Exception
     {
-        OutputValidator validator = executeWithRunOrder( "alphabetical" );
+        assumeJavaVersion( 1.8d );
+        OutputValidator validator = executeWithRunOrder( "alphabetical", "junit5" );
         assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_ALPHABETICAL_ORDER );
     }
 
     @Test
-    public void testReverseAlphabetical()
+    public void testReverseAlphabeticalJUnit4()
+        throws Exception
+    {
+        OutputValidator validator = executeWithRunOrder( "reversealphabetical", "junit4" );
+        assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_REVERSE_ALPHABETICAL_ORDER );
+    }
+
+    @Test
+    public void testReverseAlphabeticalJUnit5()
         throws Exception
     {
-        OutputValidator validator = executeWithRunOrder( "reversealphabetical" );
+        assumeJavaVersion( 1.8d );
+        OutputValidator validator = executeWithRunOrder( "reversealphabetical", "junit5" );
         assertTestnamesAppearInSpecificOrder( validator, TESTS_IN_REVERSE_ALPHABETICAL_ORDER );
     }
 
     @Test
-    public void testHourly()
+    public void testHourlyJUnit4()
         throws Exception
     {
         int startHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
-        OutputValidator validator = executeWithRunOrder( "hourly" );
+        OutputValidator validator = executeWithRunOrder( "hourly", "junit4" );
         int endHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
         if ( startHour != endHour )
         {
@@ -74,21 +94,58 @@ public class RunOrderIT
     }
 
     @Test
-    public void testNonExistingRunOrder()
+    public void testHourlyJUnit5()
         throws Exception
     {
+        assumeJavaVersion( 1.8d );
+        int startHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
+        OutputValidator validator = executeWithRunOrder( "hourly", "junit5" );
+        int endHour = Calendar.getInstance().get( Calendar.HOUR_OF_DAY );
+        if ( startHour != endHour )
+        {
+            return; // Race condition, cannot test when hour changed mid-run
+        }
+
+        String[] testnames =
+            ( ( startHour % 2 ) == 0 ) ? TESTS_IN_ALPHABETICAL_ORDER : TESTS_IN_REVERSE_ALPHABETICAL_ORDER;
+        assertTestnamesAppearInSpecificOrder( validator, testnames );
+    }
+
+    @Test
+    public void testNonExistingRunOrderJUnit4()
+    {
+        unpack()
+            .activateProfile( "junit4" )
+            .forkMode( getForkMode() )
+            .runOrder( "nonExistingRunOrder" )
+            .maven()
+            .withFailure()
+            .executeTest()
+            .verifyTextInLog( "There's no RunOrder with the name nonExistingRunOrder." );
+    }
+
+    @Test
+    public void testNonExistingRunOrderJUnit5()
+    {
+        assumeJavaVersion( 1.8d );
         unpack()
-                .forkMode( getForkMode() )
-                .runOrder( "nonExistingRunOrder" )
-                .maven()
-                .withFailure()
-                .executeTest()
-                .verifyTextInLog( "There's no RunOrder with the name nonExistingRunOrder." );
+            .activateProfile( "junit5" )
+            .forkMode( getForkMode() )
+            .runOrder( "nonExistingRunOrder" )
+            .maven()
+            .withFailure()
+            .executeTest()
+            .verifyTextInLog( "There's no RunOrder with the name nonExistingRunOrder." );
     }
 
-    private OutputValidator executeWithRunOrder( String runOrder )
+    private OutputValidator executeWithRunOrder( String runOrder, String profile )
     {
-        return unpack().forkMode( getForkMode() ).runOrder( runOrder ).executeTest().verifyErrorFree( 3 );
+        return unpack()
+            .activateProfile( profile )
+            .forkMode( getForkMode() )
+            .runOrder( runOrder )
+            .executeTest()
+            .verifyErrorFree( 3 );
     }
 
     protected String getForkMode()
diff --git a/surefire-its/src/test/resources/runOrder/pom.xml b/surefire-its/src/test/resources/runOrder/pom.xml
index 84abb53..8f00c3b 100644
--- a/surefire-its/src/test/resources/runOrder/pom.xml
+++ b/surefire-its/src/test/resources/runOrder/pom.xml
@@ -33,15 +33,6 @@
     <maven.compiler.target>1.7</maven.compiler.target>
   </properties>
 
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>4.8.1</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
-
   <build>
     <plugins>
       <plugin>
@@ -57,4 +48,29 @@
     </plugins>
   </build>
 
+    <profiles>
+        <profile>
+            <id>junit4</id>
+            <dependencies>
+                <dependency>
+                    <groupId>junit</groupId>
+                    <artifactId>junit</artifactId>
+                    <version>4.8.1</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+        <profile>
+            <id>junit5</id>
+            <dependencies>
+                <dependency>
+                    <groupId>org.junit.vintage</groupId>
+                    <artifactId>junit-vintage-engine</artifactId>
+                    <version>5.5.2</version>
+                    <scope>test</scope>
+                </dependency>
+            </dependencies>
+        </profile>
+    </profiles>
+
 </project>