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/05/19 21:58:46 UTC
[maven-surefire] branch 1546-1222 updated (453805d -> a42f76a)
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a change to branch 1546-1222
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git.
from 453805d 3 MOJO @Parameter-s with default values
new cab974c build fix
new a42f76a added documentation + unit test + updated features + renamed 'statelessReporter' to 'statelessTestsetReporter' + updated mockito
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:
.../plugin/surefire/AbstractSurefireMojo.java | 22 +++++++--
.../maven/plugin/surefire/CommonReflector.java | 6 +--
.../maven/plugin/surefire/MojoMocklessTest.java | 21 ++++++++-
.../src/site/apt/examples/junit-platform.apt.vm | 53 ++++++++++++++++++++++
.../src/site/apt/featurematrix.apt.vm | 13 +++++-
pom.xml | 2 +-
.../junit-platform-engine-jupiter/pom.xml | 4 +-
7 files changed, 108 insertions(+), 13 deletions(-)
[maven-surefire] 01/02: build fix
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch 1546-1222
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit cab974c028f2fd5c238772474e73cea174a4614c
Author: tibordigana <ti...@apache.org>
AuthorDate: Sat May 18 16:56:31 2019 +0200
build fix
---
.../maven/plugin/surefire/AbstractSurefireMojo.java | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 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 6eae389..e878eaa 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
@@ -1951,15 +1951,26 @@ public abstract class AbstractSurefireMojo
private StartupReportConfiguration getStartupReportConfiguration( String configChecksum, boolean isForkMode )
{
- statelessReporter.setDisable( isDisableXmlReport() ); // todo change to Boolean in the version 3.0.0-M6
+ SurefireStatelessReporter xmlReporter =
+ statelessReporter == null
+ ? new SurefireStatelessReporter( /*todo call def. constr.*/ isDisableXmlReport(), "3.0" )
+ : statelessReporter;
+
+ xmlReporter.setDisable( isDisableXmlReport() ); // todo change to Boolean in the version 3.0.0-M6
+
+ SurefireConsoleOutputReporter outReporter =
+ consoleOutputReporter == null ? new SurefireConsoleOutputReporter() : consoleOutputReporter;
+
+ SurefireStatelessTestsetInfoReporter testsetReporter =
+ statelessTestsetInfoReporter == null
+ ? new SurefireStatelessTestsetInfoReporter() : statelessTestsetInfoReporter;
return new StartupReportConfiguration( isUseFile(), isPrintSummary(), getReportFormat(),
isRedirectTestOutputToFile(),
getReportsDirectory(), isTrimStackTrace(), getReportNameSuffix(),
getStatisticsFile( configChecksum ), requiresRunHistory(),
getRerunFailingTestsCount(), getReportSchemaLocation(), getEncoding(),
- isForkMode, statelessReporter, consoleOutputReporter,
- statelessTestsetInfoReporter );
+ isForkMode, xmlReporter, outReporter, testsetReporter );
}
private boolean isSpecificTestSpecified()
[maven-surefire] 02/02: added documentation + unit test + updated
features + renamed 'statelessReporter' to 'statelessTestsetReporter' +
updated mockito
Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
tibordigana pushed a commit to branch 1546-1222
in repository https://gitbox.apache.org/repos/asf/maven-surefire.git
commit a42f76ad4132c11a7dbb92cc630c97b29aa23909
Author: tibordigana <ti...@apache.org>
AuthorDate: Sun May 19 23:58:36 2019 +0200
added documentation + unit test + updated features + renamed 'statelessReporter' to 'statelessTestsetReporter' + updated mockito
---
.../plugin/surefire/AbstractSurefireMojo.java | 9 ++--
.../maven/plugin/surefire/CommonReflector.java | 6 +--
.../maven/plugin/surefire/MojoMocklessTest.java | 21 ++++++++-
.../src/site/apt/examples/junit-platform.apt.vm | 53 ++++++++++++++++++++++
.../src/site/apt/featurematrix.apt.vm | 13 +++++-
pom.xml | 2 +-
.../junit-platform-engine-jupiter/pom.xml | 4 +-
7 files changed, 96 insertions(+), 12 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 e878eaa..2f179e8 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
@@ -163,7 +163,7 @@ public abstract class AbstractSurefireMojo
* Note: use the legacy system property <em>disableXmlReport</em> set to {@code true} to disable the report.
*/
@Parameter
- private SurefireStatelessReporter statelessReporter;
+ private SurefireStatelessReporter statelessTestsetReporter;
@Parameter
private SurefireConsoleOutputReporter consoleOutputReporter;
@@ -685,7 +685,8 @@ public abstract class AbstractSurefireMojo
/**
* Flag to disable the generation of report files in xml format.
- * Deprecated since 3.0.0-M4. Instead use <em>disable</em> within {@code statelessReporter} since of 3.0.0-M6.
+ * Deprecated since 3.0.0-M4.
+ * Instead use <em>disable</em> within {@code statelessTestsetReporter} since of 3.0.0-M6.
* @since 2.2
*/
@Deprecated // todo make readonly to handle system property
@@ -1952,9 +1953,9 @@ public abstract class AbstractSurefireMojo
private StartupReportConfiguration getStartupReportConfiguration( String configChecksum, boolean isForkMode )
{
SurefireStatelessReporter xmlReporter =
- statelessReporter == null
+ statelessTestsetReporter == null
? new SurefireStatelessReporter( /*todo call def. constr.*/ isDisableXmlReport(), "3.0" )
- : statelessReporter;
+ : statelessTestsetReporter;
xmlReporter.setDisable( isDisableXmlReport() ); // todo change to Boolean in the version 3.0.0-M6
diff --git a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
index b49ce4f..fc9ee51 100644
--- a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
+++ b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/CommonReflector.java
@@ -42,7 +42,7 @@ public class CommonReflector
{
private final Class<?> startupReportConfiguration;
private final Class<?> consoleLogger;
- private final Class<?> statelessReporter;
+ private final Class<?> statelessTestsetReporter;
private final Class<?> consoleOutputReporter;
private final Class<?> statelessTestsetInfoReporter;
private final ClassLoader surefireClassLoader;
@@ -55,7 +55,7 @@ public class CommonReflector
{
startupReportConfiguration = surefireClassLoader.loadClass( StartupReportConfiguration.class.getName() );
consoleLogger = surefireClassLoader.loadClass( ConsoleLogger.class.getName() );
- statelessReporter = surefireClassLoader.loadClass( StatelessReporter.class.getName() );
+ statelessTestsetReporter = surefireClassLoader.loadClass( StatelessReporter.class.getName() );
consoleOutputReporter = surefireClassLoader.loadClass( ConsoleOutputReporter.class.getName() );
statelessTestsetInfoReporter =
surefireClassLoader.loadClass( StatelessTestsetInfoReporter.class.getName() );
@@ -82,7 +82,7 @@ public class CommonReflector
String.class, boolean.class, File.class,
boolean.class, String.class, File.class, boolean.class,
int.class, String.class, String.class, boolean.class,
- statelessReporter, consoleOutputReporter,
+ statelessTestsetReporter, consoleOutputReporter,
statelessTestsetInfoReporter );
//noinspection BooleanConstructorCall
Object[] params = { reporterConfiguration.isUseFile(), reporterConfiguration.isPrintSummary(),
diff --git a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
index 166cf4b..4371638 100644
--- a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
+++ b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/MojoMocklessTest.java
@@ -52,10 +52,29 @@ public class MojoMocklessTest
public void testGetStartupReportConfiguration() throws Exception
{
AbstractSurefireMojo surefirePlugin = new Mojo( null, null );
+ StartupReportConfiguration config = invokeMethod( surefirePlugin, "getStartupReportConfiguration", "", false );
+
+ assertThat( config.getXmlReporter() )
+ .isNotNull()
+ .isInstanceOf( SurefireStatelessReporter.class );
+
+ assertThat( config.getConsoleOutputReporter() )
+ .isNotNull()
+ .isInstanceOf( SurefireConsoleOutputReporter.class );
+
+ assertThat( config.getTestsetReporter() )
+ .isNotNull()
+ .isInstanceOf( SurefireStatelessTestsetInfoReporter.class );
+ }
+
+ @Test
+ public void testGetStartupReportConfiguration2() throws Exception
+ {
+ AbstractSurefireMojo surefirePlugin = new Mojo( null, null );
SurefireStatelessReporter xmlReporter = new SurefireStatelessReporter( false, "3.0" );
SurefireConsoleOutputReporter consoleReporter = new SurefireConsoleOutputReporter();
SurefireStatelessTestsetInfoReporter testsetInfoReporter = new SurefireStatelessTestsetInfoReporter();
- setInternalState( surefirePlugin, "statelessReporter", xmlReporter );
+ setInternalState( surefirePlugin, "statelessTestsetReporter", xmlReporter );
setInternalState( surefirePlugin, "consoleOutputReporter", consoleReporter );
setInternalState( surefirePlugin, "statelessTestsetInfoReporter", testsetInfoReporter );
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 1a11987..ccc4c4a 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
@@ -309,3 +309,56 @@ else
</build>
...
+---+
+
+
+* Surefire Extensions and Reports Configuration for @DisplayName
+
+ Since plugin version 3.0.0-M4 you can use fine grained configuration of reports and enable phrased names together
+ with <<<...@DisplayName>>> in you tests.
+ This is the complete list of attributes of particular objects. You do not have to specify e.g. <<<disable>>>,
+ <<<version>>> and <<<encoding>>>. The boolean values reach default values <<<false>>> if not specified otherwise.
+
++---+
+...
+<build>
+ <plugins>
+ ...
+ <plugin>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>${project.artifactId}</artifactId>
+ <version>${project.version}</version>
+ <configuration>
+ <statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5Xml30StatelessReporter">
+ <disable>false</disable>
+ <version>3.0</version>
+ <usePhrasedFileName>false</usePhrasedFileName>
+ <usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
+ <usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
+ <usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
+ </statelessTestsetReporter>
+ <consoleOutputReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5ConsoleOutputReporter">
+ <disable>false</disable>
+ <encoding>UTF-8</encoding>
+ <usePhrasedFileName>false</usePhrasedFileName>
+ </consoleOutputReporter>
+ <statelessTestsetInfoReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5StatelessTestsetInfoReporter">
+ <disable>false</disable>
+ <usePhrasedFileName>false</usePhrasedFileName>
+ <usePhrasedClassNameInRunning>true</usePhrasedClassNameInRunning>
+ <usePhrasedClassNameInTestCaseSummary>true</usePhrasedClassNameInTestCaseSummary>
+ </statelessTestsetInfoReporter>
+ </configuration>
+ </plugin>
+ </plugins>
+</build>
+...
++---+
+
+ Default implementations of these extensions are
+ <<<org.apache.maven.plugin.surefire.extensions.SurefireStatelessReporter>>>,
+ <<<org.apache.maven.plugin.surefire.extensions.SurefireConsoleOutputReporter>>>, and
+ <<<org.apache.maven.plugin.surefire.extensions.SurefireStatelessTestsetInfoReporter>>>.
+
+ The aim of extensions is to let the users customizing the default behavior. We are keen on listing useful
+ extensions on Apache Maven Surefire site if you propagate your extensions on GitHub.
+
diff --git a/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm b/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
index d4024a2..521895a 100644
--- a/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
+++ b/maven-surefire-plugin/src/site/apt/featurematrix.apt.vm
@@ -40,6 +40,14 @@ Feature Matrix
*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
| parallel support | N | N | Y | Y | N | N |
*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
+| custom run-listener | N | Y | Y | Y | - | N |
+*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
+| re-run count | N | Y | Y | N | N | N |
+*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
+| skip after failure count | N | Y | Y | Y | N | N |
+*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
+| Surefire Extensions | Y | Y | Y | Y | Y | Y(*2) |
+*---------------------------------------------+------------+----------+------------+-----------+----------+----------------------+
Legend: "Y" means supported, "N" means not supported. "?" means not tested.
@@ -50,4 +58,7 @@ Feature Matrix
(*1) The JUnit 5 Platform supports running multiple individual test methods in a single class, but there are some
corner cases that are not supported, yet: {{{https://github.com/junit-team/junit5/issues/1343}junit-team/junit5#1343}}
- and {{{https://github.com/junit-team/junit5/issues/1406}junit-team/junit5#1406)}}.
\ No newline at end of file
+ and {{{https://github.com/junit-team/junit5/issues/1406}junit-team/junit5#1406)}}.
+
+ (*2) 3 extensions related to JUnit5 annotation <<<DisplayName>>>.
+
diff --git a/pom.xml b/pom.xml
index 113e0f7..8469f31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -332,7 +332,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>2.23.4</version>
+ <version>2.27.0</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
diff --git a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
index e6525e6..59d02f4 100644
--- a/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
+++ b/surefire-its/src/test/resources/junit-platform-engine-jupiter/pom.xml
@@ -72,14 +72,14 @@
<configuration>
<forkCount>1.0C</forkCount>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
- <statelessReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5Xml30StatelessReporter">
+ <statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5Xml30StatelessReporter">
<disable>false</disable>
<version>3.0</version>
<usePhrasedFileName>false</usePhrasedFileName>
<usePhrasedTestSuiteClassName>true</usePhrasedTestSuiteClassName>
<usePhrasedTestCaseClassName>true</usePhrasedTestCaseClassName>
<usePhrasedTestCaseMethodName>true</usePhrasedTestCaseMethodName>
- </statelessReporter>
+ </statelessTestsetReporter>
<consoleOutputReporter implementation="org.apache.maven.plugin.surefire.extensions.JUnit5ConsoleOutputReporter">
<disable>false</disable>
<encoding>UTF-8</encoding>