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/06/09 21:07:40 UTC
[maven-surefire] branch
empty_element_on_failure_with_ParameterizedTest updated (f31c9bf ->
e6d5eba)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch empty_element_on_failure_with_ParameterizedTest
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
discard f31c9bf tests not in parallel so it fix the issue
discard eaccc6f add a test generating non well formed xml report
add 5f492fa Using localhost (not local loopback) in SurefireForkChannel.java
add 2e14ba6 updated the road map for 3.0.0-M5 and next versions
new 2d4bd4e [SUREFIRE-1797] Surefire report with empty element name
new e6d5eba [GH] performance problem on Windows nodes
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 (f31c9bf)
\
N -- N -- N refs/heads/empty_element_on_failure_with_ParameterizedTest (e6d5eba)
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 2 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/extensions/SurefireForkChannel.java | 2 +-
.../maven/surefire/extensions/ForkChannelTest.java | 8 ++++---
maven-surefire-plugin/src/site/apt/index.apt.vm | 21 +++++++++--------
.../api/util/internal/AsyncSocketTest.java | 2 +-
.../its/JUnitPlatformRerunFailingTestsIT.java | 10 +++++---
.../src/test/resources/fail-fast-testng/pom.xml | 1 +
.../fail-fast-testng/src/test/java/pkg/ATest.java | 2 +-
.../fail-fast-testng/src/test/java/pkg/BTest.java | 2 +-
.../fail-fast-testng/src/test/java/pkg/CTest.java | 2 +-
.../fail-fast-testng/src/test/java/pkg/DTest.java | 2 +-
.../test/java/junitplatform/ParametersTest.java | 27 ++++++++++------------
.../surefire/junitplatform/RunListenerAdapter.java | 20 ++++++++++++----
12 files changed, 58 insertions(+), 41 deletions(-)
[maven-surefire] 01/02: [SUREFIRE-1797] Surefire report with empty
element name
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch empty_element_on_failure_with_ParameterizedTest
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit 2d4bd4e459cf49592f665862595ebbb8d62c6c52
Author: olivier lamy <ol...@apache.org>
AuthorDate: Fri Jun 5 19:22:28 2020 +1000
[SUREFIRE-1797] Surefire report with empty element name
---
.../its/JUnitPlatformRerunFailingTestsIT.java | 13 ++++
.../junit-platform-rerun-failing-tests/pom.xml | 40 +++++++++++-
.../test/java/junitplatform/ParametersTest.java | 76 ++++++++++++++++++++++
.../surefire/junitplatform/RunListenerAdapter.java | 20 ++++--
4 files changed, 143 insertions(+), 6 deletions(-)
diff --git a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformRerunFailingTestsIT.java b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformRerunFailingTestsIT.java
index 2a3bdca..a6515e5 100644
--- a/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformRerunFailingTestsIT.java
+++ b/surefire-its/src/test/java/org/apache/maven/surefire/its/JUnitPlatformRerunFailingTestsIT.java
@@ -203,6 +203,19 @@ public class JUnitPlatformRerunFailingTestsIT extends SurefireJUnit4IntegrationT
verifyFailuresOneRetryOneMethod( outputValidator );
}
+ @Test
+ public void testParameterizedTest()
+ {
+ unpack()
+ .setJUnitVersion( VERSION )
+ .maven()
+ .activateProfile( "parameters" )
+ .withFailure()
+ .debugLogging()
+ .executeTest()
+ .assertTestSuiteResults( 6, 0, 1, 1, 0 );
+ }
+
private void verifyFailuresOneRetryAllClasses( OutputValidator outputValidator )
{
verifyFailuresOneRetry( outputValidator, 5, 1, 1, 0 );
diff --git a/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/pom.xml b/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/pom.xml
index af4dde0..cea4be0 100644
--- a/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/pom.xml
@@ -40,16 +40,54 @@
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.junit.jupiter</groupId>
+ <artifactId>junit-jupiter-params</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
+ <pluginManagement>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>${surefire.version}</version>
+ </plugin>
+ </plugins>
+ </pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
- <version>${surefire.version}</version>
+ <configuration>
+ <excludes>
+ <exclude>**/ParametersTest.java</exclude>
+ </excludes>
+ </configuration>
</plugin>
</plugins>
</build>
+ <profiles>
+ <profile>
+ <id>parameters</id>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>**/PassingTest.java</exclude>
+ <exclude>**/FlakyFirstTimeTest.java</exclude>
+ </excludes>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/src/test/java/junitplatform/ParametersTest.java b/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/src/test/java/junitplatform/ParametersTest.java
new file mode 100644
index 0000000..a4e4e38
--- /dev/null
+++ b/surefire-its/src/test/resources/junit-platform-rerun-failing-tests/src/test/java/junitplatform/ParametersTest.java
@@ -0,0 +1,76 @@
+package junitplatform;
+
+/*
+ * 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 org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assumptions;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.MethodSource;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+
+import java.util.stream.Stream;
+
+
+public class ParametersTest
+{
+ public static Stream<ConnectionPoolFactory> pools()
+ {
+ return Stream.of( new ConnectionPoolFactory( "duplex" ),
+ new ConnectionPoolFactory( "multiplex" ),
+ new ConnectionPoolFactory( "round-robin" ) );
+ }
+
+ @ParameterizedTest
+ @MethodSource( "pools" )
+ public void testAllPassingTest( ConnectionPoolFactory factory )
+ {
+ System.out.println( "testAllPassingTest factory " + factory );
+ }
+
+ @ParameterizedTest
+ @MethodSource( "pools" )
+ public void testOneFailingPassingTest( ConnectionPoolFactory factory ) throws Exception
+ {
+ Assumptions.assumeFalse( factory.name.equals( "round-robin" ) );
+ System.out.println( "Passing test factory " + factory );
+ if ( factory.name.equals( "multiplex" ) )
+ {
+ assertEquals( 1, 2 );
+ }
+ }
+
+ private static class ConnectionPoolFactory
+ {
+ private final String name;
+
+ private ConnectionPoolFactory( String name )
+ {
+ this.name = name;
+ }
+
+ @Override
+ public String toString()
+ {
+ return name;
+ }
+ }
+}
diff --git a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
index 31c010a..c0cfed2 100644
--- a/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
+++ b/surefire-providers/surefire-junit-platform/src/main/java/org/apache/maven/surefire/junitplatform/RunListenerAdapter.java
@@ -22,6 +22,7 @@ package org.apache.maven.surefire.junitplatform;
import static java.util.Collections.emptyMap;
import static java.util.stream.Collectors.joining;
import static org.apache.maven.surefire.api.util.internal.ObjectUtils.systemProps;
+import static org.apache.maven.surefire.shared.lang3.StringUtils.isNotBlank;
import static org.junit.platform.engine.TestExecutionResult.Status.FAILED;
import java.util.Map;
@@ -255,13 +256,22 @@ final class RunListenerAdapter
.map( s -> s.substring( 1 + s.lastIndexOf( '.' ) ) )
.collect( joining( "," ) );
- boolean hasParams = !simpleClassNames.isEmpty();
+ boolean hasParams = isNotBlank( methodSource.getMethodParameterTypes() );
String methodName = methodSource.getMethodName();
- String methodSign = methodName + '(' + simpleClassNames + ')';
String description = testIdentifier.getLegacyReportingName();
- boolean useDesc = description.startsWith( methodSign );
- String methodDesc = hasParams ? ( useDesc ? description : methodSign ) : methodName;
- String methodDisp = methodSign.equals( display ) ? methodDesc : display;
+ String methodSign = hasParams ? methodName + '(' + simpleClassNames + ')' : methodName;
+ boolean equalDescriptions = display.equals( description );
+ boolean hasLegacyDescription = description.startsWith( methodName + '(' );
+ boolean hasDisplayName = !equalDescriptions || !hasLegacyDescription;
+ String methodDesc = equalDescriptions || !hasParams ? methodSign : description;
+ String methodDisp = hasDisplayName ? display : methodDesc;
+
+ // The behavior of methods getLegacyReportingName() and getDisplayName().
+ // test || legacy | display
+ // ==============||==========|==========
+ // normal || m() | m()
+ // normal+displ || displ | displ
+ // parameterized || m()[1] | displ
return new String[] {source[0], source[1], methodDesc, methodDisp};
}
[maven-surefire] 02/02: [GH] performance problem on Windows nodes
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch empty_element_on_failure_with_ParameterizedTest
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit e6d5eba764f98533b7185da6459c8a335e8b21b6
Author: tibordigana <ti...@apache.org>
AuthorDate: Tue Jun 9 22:16:10 2020 +0200
[GH] performance problem on Windows nodes
---
surefire-its/src/test/resources/fail-fast-testng/pom.xml | 1 +
.../src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java | 2 +-
.../src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java | 2 +-
.../src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java | 2 +-
.../src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java | 2 +-
5 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/surefire-its/src/test/resources/fail-fast-testng/pom.xml b/surefire-its/src/test/resources/fail-fast-testng/pom.xml
index ed07d8a..c891407 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/pom.xml
+++ b/surefire-its/src/test/resources/fail-fast-testng/pom.xml
@@ -51,6 +51,7 @@
<configuration>
<runOrder>alphabetical</runOrder>
<forkMode>once</forkMode><!--override to default value in order to enable forkCount-->
+ <argLine>-Xms64m -Xmx128m</argLine>
</configuration>
</plugin>
</plugins>
diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
index 45b772a..6cd8516 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
+++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/ATest.java
@@ -10,7 +10,7 @@ public class ATest
public void someMethod()
throws InterruptedException
{
- MILLISECONDS.sleep( 3600L );
+ MILLISECONDS.sleep( 4_800L );
throw new RuntimeException( "assert \"foo\" == \"bar\"\n"
+ " |\n"
+ " false" );
diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
index 511a146..7b40806 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
+++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/BTest.java
@@ -10,7 +10,7 @@ public class BTest
public void test()
throws InterruptedException
{
- MILLISECONDS.sleep( 9000L );
+ MILLISECONDS.sleep( 12_000L );
throw new RuntimeException();
}
diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
index 7270162..f1aeafb 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
+++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/CTest.java
@@ -10,7 +10,7 @@ public class CTest
public void test()
throws InterruptedException
{
- MILLISECONDS.sleep( 9000L );
+ MILLISECONDS.sleep( 12_000L );
}
}
diff --git a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
index cf5bfed..64cfaa6 100644
--- a/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
+++ b/surefire-its/src/test/resources/fail-fast-testng/src/test/java/pkg/DTest.java
@@ -10,7 +10,7 @@ public class DTest
public void test()
throws InterruptedException
{
- MILLISECONDS.sleep( 9000L );
+ MILLISECONDS.sleep( 12_000L );
}
}