You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by so...@apache.org on 2019/01/30 19:56:23 UTC

[maven-surefire] branch master updated: Add JUnit Jupiter integration test using DisplayName

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 0493e1b  Add JUnit Jupiter integration test using DisplayName
0493e1b is described below

commit 0493e1b9e53e819b9c483bfa7da6d15fa2de0e4d
Author: Christian Stein <so...@gmail.com>
AuthorDate: Wed Jan 30 20:56:11 2019 +0100

    Add JUnit Jupiter integration test using DisplayName
    
    Partly disabled/commented as it is blocked by SUREFIRE-1222
---
 .../apache/maven/surefire/its/JUnitPlatformIT.java | 15 +++++++-
 .../DisplayNameTest.java                           | 43 ++++++++++++++++++++++
 2 files changed, 56 insertions(+), 2 deletions(-)

diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
index 6c8d29d..4144ec6 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformIT.java
@@ -19,6 +19,7 @@ package org.apache.maven.surefire.its;
  * under the License.
  */
 
+import org.apache.maven.surefire.its.fixture.OutputValidator;
 import org.apache.maven.surefire.its.fixture.SurefireJUnit4IntegrationTestCase;
 import org.junit.Before;
 import org.junit.Test;
@@ -37,9 +38,19 @@ public class JUnitPlatformIT
     @Test
     public void testJupiterEngine()
     {
-        unpack( "/junit-platform-engine-jupiter" )
+        OutputValidator validator = unpack( "/junit-platform-engine-jupiter" )
                 .executeTest()
-                .verifyErrorFree( 5 );
+                .verifyErrorFree( 7 );
+
+        validator.getSurefireReportsFile( "junitplatformenginejupiter.DisplayNameTest.txt" )
+                 // .assertContainsText( "<< ✨ >>" ) // after @DisplayName is uncommented via SUREFIRE-1222
+                 .assertContainsText( "Test set: junitplatformenginejupiter.DisplayNameTest" );
+
+        validator.getSurefireReportsFile( "TEST-junitplatformenginejupiter.DisplayNameTest.xml" )
+                 // At the moment, the testcase with the same is reported twice: test1() and test2() use the same display name
+                 // SUREFIRE-1222 will solve this.
+                 .assertContainsText( "testcase name=\"73$71 ✔\" classname=\"junitplatformenginejupiter.DisplayNameTest\"" )
+                 .assertContainsText( "testcase name=\"73$71 ✔\" classname=\"junitplatformenginejupiter.DisplayNameTest\"" );
     }
 
     @Test
diff --git a/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java b/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java
new file mode 100644
index 0000000..8089ad0
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-platform-engine-jupiter/src/test/java/junitplatformenginejupiter/DisplayNameTest.java
@@ -0,0 +1,43 @@
+package junitplatformenginejupiter;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+
+import org.junit.jupiter.api.DisplayName;
+import org.junit.jupiter.api.Test;
+
+// TODO Uncomment after SUREFIRE-1222 is done
+// @DisplayName("<< ✨ >>")
+class DisplayNameTest
+{
+    @Test
+    @DisplayName("73$71 ✔")
+    void test1()
+    {
+    }
+
+    @Test
+    @DisplayName("73$71 ✔")
+    void test2()
+    {
+    }
+}