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

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

commit 786b0169e394795fac9deebdc5f7d0dbe4544465
Author: Michael Osipov <[email protected]>
AuthorDate: Mon Jul 1 23:04:10 2024 +0200

    [SUREFIRE-1360] Ability to disable properties for successfully passed tests
    
    This closes #755
---
 .../plugin/surefire/AbstractSurefireMojo.java      | 26 ++++++++++++++++++-
 .../maven/plugin/surefire/CommonReflector.java     |  2 ++
 .../surefire/StartupReportConfiguration.java       |  9 +++++++
 .../DefaultStatelessReportMojoConfiguration.java   |  4 ++-
 .../extensions/SurefireStatelessReporter.java      |  3 ++-
 .../junit5/JUnit5Xml30StatelessReporter.java       |  3 ++-
 .../surefire/report/NullStatelessXmlReporter.java  |  2 +-
 .../surefire/report/StatelessXmlReporter.java      | 30 +++++++++++++++++++---
 .../maven/plugin/surefire/CommonReflectorTest.java |  1 +
 .../surefire/booterclient/ForkStarterTest.java     |  2 ++
 .../booterclient/TestSetMockReporterFactory.java   |  1 +
 .../surefire/extensions/StatelessReporterTest.java |  4 +--
 .../report/DefaultReporterFactoryTest.java         |  3 +++
 .../surefire/report/StatelessXmlReporterTest.java  |  7 +++--
 .../api/booter/ProviderParameterNames.java         |  2 ++
 .../StatelessReportMojoConfiguration.java          | 10 +++++++-
 .../surefire/junitcore/JUnitCoreParameters.java    | 12 ++++++++-
 .../junitcore/JUnitCoreParametersTest.java         |  1 +
 .../maven/surefire/junitcore/JUnitCoreTester.java  |  1 +
 19 files changed, 109 insertions(+), 14 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 8552fcdcc..bdd76ff64 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
@@ -700,6 +700,14 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
     @Parameter(property = "enableOutErrElements", defaultValue = "true")
     private boolean enableOutErrElements;
 
+    /**
+     * Flag for including/excluding {@code <properties />} element for 
successfully passed tests in XML reports.
+     *
+     * @since 3.3.1
+     */
+    @Parameter(property = "enablePropertiesElement", defaultValue = "true")
+    private boolean enablePropertiesElement;
+
     /**
      * The current build session instance.
      */
@@ -1488,6 +1496,10 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
                 .setProperty(
                         ProviderParameterNames.ENABLE_OUT_ERR_ELEMENTS_PROP,
                         Boolean.toString(isEnableOutErrElements()));
+        getProperties()
+                .setProperty(
+                        ProviderParameterNames.ENABLE_PROPERTIES_ELEMENT_PROP,
+                        Boolean.toString(isEnablePropertiesElement()));
 
         String message = "parallel='" + usedParallel + '\''
                 + ", perCoreThreadCount=" + getPerCoreThreadCount()
@@ -1497,7 +1509,8 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
                 + ", threadCountClasses=" + getThreadCountClasses()
                 + ", threadCountMethods=" + getThreadCountMethods()
                 + ", parallelOptimized=" + isParallelOptimized()
-                + ", enableOutErrElements=" + isEnableOutErrElements();
+                + ", enableOutErrElements=" + isEnableOutErrElements()
+                + ", enablePropertiesElement=" + isEnablePropertiesElement();
 
         logDebugOrCliShowErrors(message);
     }
@@ -1992,6 +2005,7 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
                 getEncoding(),
                 isForking,
                 isEnableOutErrElements(),
+                isEnablePropertiesElement(),
                 xmlReporter,
                 outReporter,
                 testsetReporter);
@@ -2533,6 +2547,7 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
         checksum.add(useModulePath());
         checksum.add(getEnableProcessChecker());
         checksum.add(isEnableOutErrElements());
+        checksum.add(isEnablePropertiesElement());
         addPluginSpecificChecksumItems(checksum);
         return checksum.getSha1();
     }
@@ -3498,6 +3513,15 @@ public abstract class AbstractSurefireMojo extends 
AbstractMojo implements Suref
         this.enableOutErrElements = enableOutErrElements;
     }
 
+    public boolean isEnablePropertiesElement() {
+        return enablePropertiesElement;
+    }
+
+    @SuppressWarnings("UnusedDeclaration")
+    public void setEnablePropertiesElement(boolean enablePropertiesElement) {
+        this.enablePropertiesElement = enablePropertiesElement;
+    }
+
     public MavenSession getSession() {
         return session;
     }
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 4aaa34c63..e902722b4 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
@@ -87,6 +87,7 @@ public class CommonReflector {
                 String.class,
                 boolean.class,
                 boolean.class,
+                boolean.class,
                 statelessTestsetReporter,
                 consoleOutputReporter,
                 statelessTestsetInfoReporter);
@@ -105,6 +106,7 @@ public class CommonReflector {
             reporterConfiguration.getEncoding().name(),
             reporterConfiguration.isForking(),
             reporterConfiguration.isEnableOutErrElements(),
+            reporterConfiguration.isEnablePropertiesElement(),
             reporterConfiguration.getXmlReporter().clone(surefireClassLoader),
             
reporterConfiguration.getConsoleOutputReporter().clone(surefireClassLoader),
             
reporterConfiguration.getTestsetReporter().clone(surefireClassLoader)
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
index b4994869e..43486c0ca 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/StartupReportConfiguration.java
@@ -87,6 +87,8 @@ public final class StartupReportConfiguration {
 
     private final boolean enableOutErrElements;
 
+    private final boolean enablePropertiesElement;
+
     private final SurefireStatelessReporter xmlReporter;
 
     private final SurefireConsoleOutputReporter consoleOutputReporter;
@@ -111,6 +113,7 @@ public final class StartupReportConfiguration {
             String encoding,
             boolean isForking,
             boolean enableOutErrElements,
+            boolean enablePropertiesElement,
             SurefireStatelessReporter xmlReporter,
             SurefireConsoleOutputReporter consoleOutputReporter,
             SurefireStatelessTestsetInfoReporter testsetReporter) {
@@ -131,6 +134,7 @@ public final class StartupReportConfiguration {
         this.encoding = charset == null ? UTF_8 : Charset.forName(charset);
         this.isForking = isForking;
         this.enableOutErrElements = enableOutErrElements;
+        this.enablePropertiesElement = enablePropertiesElement;
         this.xmlReporter = xmlReporter;
         this.consoleOutputReporter = consoleOutputReporter;
         this.testsetReporter = testsetReporter;
@@ -182,6 +186,7 @@ public final class StartupReportConfiguration {
                 rerunFailingTestsCount,
                 xsdSchemaLocation,
                 enableOutErrElements,
+                enablePropertiesElement,
                 testClassMethodRunHistory);
 
         return xmlReporter.isDisable() ? null : 
xmlReporter.createListener(xmlReporterConfig);
@@ -248,6 +253,10 @@ public final class StartupReportConfiguration {
         return enableOutErrElements;
     }
 
+    public boolean isEnablePropertiesElement() {
+        return enablePropertiesElement;
+    }
+
     private File resolveReportsDirectory(Integer forkNumber) {
         return forkNumber == null ? reportsDirectory : 
replaceForkThreadsInPath(reportsDirectory, forkNumber);
     }
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java
index 57cae2ad9..44479a13d 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/DefaultStatelessReportMojoConfiguration.java
@@ -44,6 +44,7 @@ public class DefaultStatelessReportMojoConfiguration extends 
StatelessReportMojo
             int rerunFailingTestsCount,
             String xsdSchemaLocation,
             boolean enableOutErrElements,
+            boolean enablePropertiesElement,
             Map<String, Deque<WrappedReportEntry>> testClassMethodRunHistory) {
         super(
                 reportsDirectory,
@@ -51,7 +52,8 @@ public class DefaultStatelessReportMojoConfiguration extends 
StatelessReportMojo
                 trimStackTrace,
                 rerunFailingTestsCount,
                 xsdSchemaLocation,
-                enableOutErrElements);
+                enableOutErrElements,
+                enablePropertiesElement);
         this.testClassMethodRunHistory = testClassMethodRunHistory;
     }
 
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java
index 5083418bc..55bb25790 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/SurefireStatelessReporter.java
@@ -69,7 +69,8 @@ public class SurefireStatelessReporter
                 false,
                 false,
                 false,
-                configuration.isEnableOutErrElements());
+                configuration.isEnableOutErrElements(),
+                configuration.isEnablePropertiesElement());
     }
 
     @Override
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java
index a72f22386..9207d545e 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/extensions/junit5/JUnit5Xml30StatelessReporter.java
@@ -108,7 +108,8 @@ public class JUnit5Xml30StatelessReporter extends 
SurefireStatelessReporter {
                 getUsePhrasedTestSuiteClassName(),
                 getUsePhrasedTestCaseClassName(),
                 getUsePhrasedTestCaseMethodName(),
-                configuration.isEnableOutErrElements());
+                configuration.isEnableOutErrElements(),
+                configuration.isEnablePropertiesElement());
     }
 
     @Override
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
index dc24f66a3..d4738df40 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/NullStatelessXmlReporter.java
@@ -29,7 +29,7 @@ class NullStatelessXmlReporter extends StatelessXmlReporter {
     static final NullStatelessXmlReporter INSTANCE = new 
NullStatelessXmlReporter();
 
     private NullStatelessXmlReporter() {
-        super(null, null, false, 0, null, null, null, false, false, false, 
false, true);
+        super(null, null, false, 0, null, null, null, false, false, false, 
false, true, true);
     }
 
     @Override
diff --git 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
index f8c14bdaa..7724b1210 100644
--- 
a/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
+++ 
b/maven-surefire-common/src/main/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporter.java
@@ -118,6 +118,8 @@ public class StatelessXmlReporter implements 
StatelessReportEventListener<Wrappe
 
     private final boolean enableOutErrElements;
 
+    private final boolean enablePropertiesElement;
+
     public StatelessXmlReporter(
             File reportsDirectory,
             String reportNameSuffix,
@@ -130,19 +132,21 @@ public class StatelessXmlReporter implements 
StatelessReportEventListener<Wrappe
             boolean phrasedSuiteName,
             boolean phrasedClassName,
             boolean phrasedMethodName,
-            boolean enableOutErrElements) {
+            boolean enableOutErrElements,
+            boolean enablePropertiesElement) {
         this.reportsDirectory = reportsDirectory;
         this.reportNameSuffix = reportNameSuffix;
         this.trimStackTrace = trimStackTrace;
         this.rerunFailingTestsCount = rerunFailingTestsCount;
         this.testClassMethodRunHistoryMap = testClassMethodRunHistoryMap;
         this.xsdSchemaLocation = xsdSchemaLocation;
-        this.enableOutErrElements = enableOutErrElements;
         this.xsdVersion = xsdVersion;
         this.phrasedFileName = phrasedFileName;
         this.phrasedSuiteName = phrasedSuiteName;
         this.phrasedClassName = phrasedClassName;
         this.phrasedMethodName = phrasedMethodName;
+        this.enableOutErrElements = enableOutErrElements;
+        this.enablePropertiesElement = enablePropertiesElement;
     }
 
     @Override
@@ -158,7 +162,27 @@ public class StatelessXmlReporter implements 
StatelessReportEventListener<Wrappe
 
             createTestSuiteElement(ppw, testSetReportEntry, testSetStats); // 
TestSuite
 
-            showProperties(ppw, testSetReportEntry.getSystemProperties());
+            if (enablePropertiesElement) {
+                showProperties(ppw, testSetReportEntry.getSystemProperties());
+            } else {
+                boolean hasNonSuccess = false;
+                for (Map<String, List<WrappedReportEntry>> statistics : 
classMethodStatistics.values()) {
+                    for (List<WrappedReportEntry> thisMethodRuns : 
statistics.values()) {
+                        if (thisMethodRuns.stream()
+                                .anyMatch(entry -> entry.getReportEntryType() 
!= ReportEntryType.SUCCESS)) {
+                            hasNonSuccess = true;
+                            break;
+                        }
+                    }
+                    if (hasNonSuccess) {
+                        break;
+                    }
+                }
+
+                if (hasNonSuccess) {
+                    showProperties(ppw, 
testSetReportEntry.getSystemProperties());
+                }
+            }
 
             for (Entry<String, Map<String, List<WrappedReportEntry>>> 
statistics : classMethodStatistics.entrySet()) {
                 for (Entry<String, List<WrappedReportEntry>> thisMethodRuns :
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
index 45d9b27dd..6fd82d6cb 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/CommonReflectorTest.java
@@ -83,6 +83,7 @@ public class CommonReflectorTest {
                 null,
                 false,
                 true,
+                true,
                 xmlReporter,
                 consoleOutputReporter,
                 infoReporter);
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java
index b10e919b7..b16765038 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/ForkStarterTest.java
@@ -163,6 +163,7 @@ public class ForkStarterTest {
                 null,
                 true,
                 true,
+                true,
                 xmlReporter,
                 outputReporter,
                 statelessTestsetInfoReporter);
@@ -249,6 +250,7 @@ public class ForkStarterTest {
                 null,
                 true,
                 true,
+                true,
                 xmlReporter,
                 outputReporter,
                 statelessTestsetInfoReporter);
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
index c8dc5b236..8a419acec 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/booterclient/TestSetMockReporterFactory.java
@@ -67,6 +67,7 @@ public class TestSetMockReporterFactory extends 
DefaultReporterFactory {
                 null,
                 true,
                 true,
+                true,
                 new SurefireStatelessReporter(),
                 new SurefireConsoleOutputReporter(),
                 new SurefireStatelessTestsetInfoReporter());
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java
index 8ee90ee2c..377cf68f1 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/extensions/StatelessReporterTest.java
@@ -66,7 +66,7 @@ public class StatelessReporterTest {
         String schema = 
"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd";;
         Map<String, Deque<WrappedReportEntry>> testClassMethodRunHistory = new 
HashMap<>();
         DefaultStatelessReportMojoConfiguration config = new 
DefaultStatelessReportMojoConfiguration(
-                reportsDirectory, reportNameSuffix, true, 5, schema, true, 
testClassMethodRunHistory);
+                reportsDirectory, reportNameSuffix, true, 5, schema, true, 
true, testClassMethodRunHistory);
         SurefireStatelessReporter extension = new SurefireStatelessReporter();
 
         assertThat(extension.getVersion()).isEqualTo("3.0.1");
@@ -141,7 +141,7 @@ public class StatelessReporterTest {
         String schema = 
"https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report.xsd";;
         Map<String, Deque<WrappedReportEntry>> testClassMethodRunHistory = new 
HashMap<>();
         DefaultStatelessReportMojoConfiguration config = new 
DefaultStatelessReportMojoConfiguration(
-                reportsDirectory, reportNameSuffix, true, 5, schema, true, 
testClassMethodRunHistory);
+                reportsDirectory, reportNameSuffix, true, 5, schema, true, 
true, testClassMethodRunHistory);
         JUnit5Xml30StatelessReporter extension = new 
JUnit5Xml30StatelessReporter();
 
         assertThat(extension.getVersion()).isEqualTo("3.0.1");
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
index 081248f47..484d71798 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/DefaultReporterFactoryTest.java
@@ -86,6 +86,7 @@ public class DefaultReporterFactoryTest extends TestCase {
                 null,
                 false,
                 true,
+                true,
                 new SurefireStatelessReporter(),
                 new SurefireConsoleOutputReporter(),
                 new SurefireStatelessTestsetInfoReporter());
@@ -290,6 +291,7 @@ public class DefaultReporterFactoryTest extends TestCase {
                 null,
                 false,
                 true,
+                true,
                 new SurefireStatelessReporter(),
                 new SurefireConsoleOutputReporter(),
                 new SurefireStatelessTestsetInfoReporter());
@@ -355,6 +357,7 @@ public class DefaultReporterFactoryTest extends TestCase {
                 null,
                 false,
                 true,
+                true,
                 new SurefireStatelessReporter(),
                 new SurefireConsoleOutputReporter(),
                 new SurefireStatelessTestsetInfoReporter());
diff --git 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
index 70e87e0e1..aa41e4b77 100644
--- 
a/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
+++ 
b/maven-surefire-common/src/test/java/org/apache/maven/plugin/surefire/report/StatelessXmlReporterTest.java
@@ -110,6 +110,7 @@ public class StatelessXmlReporterTest extends TestCase {
                 false,
                 false,
                 false,
+                true,
                 true);
         reporter.cleanTestHistoryMap();
 
@@ -171,6 +172,7 @@ public class StatelessXmlReporterTest extends TestCase {
                 false,
                 false,
                 false,
+                true,
                 true);
         reporter.testSetCompleted(testSetReportEntry, stats);
 
@@ -274,6 +276,7 @@ public class StatelessXmlReporterTest extends TestCase {
                 false,
                 false,
                 false,
+                true,
                 true);
 
         reporter.testSetCompleted(testSetReportEntry, stats);
@@ -373,7 +376,7 @@ public class StatelessXmlReporterTest extends TestCase {
         rerunStats.testSucceeded(testTwoSecondError);
 
         StatelessXmlReporter reporter = new StatelessXmlReporter(
-                reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", 
false, false, false, false, true);
+                reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", 
false, false, false, false, true, true);
 
         WrappedReportEntry testSetReportEntry = new WrappedReportEntry(
                 new SimpleReportEntry(
@@ -537,7 +540,7 @@ public class StatelessXmlReporterTest extends TestCase {
                 null);
 
         StatelessXmlReporter reporter = new StatelessXmlReporter(
-                reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", 
false, false, false, false, true);
+                reportDir, null, false, 1, new HashMap<>(), XSD, "3.0.1", 
false, false, false, false, true, true);
 
         reporter.testSetCompleted(testReport, stats);
     }
diff --git 
a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java
 
b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java
index 95da2d3be..b657888d2 100644
--- 
a/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java
+++ 
b/surefire-api/src/main/java/org/apache/maven/surefire/api/booter/ProviderParameterNames.java
@@ -47,4 +47,6 @@ public class ProviderParameterNames {
     public static final String PARALLEL_OPTIMIZE_PROP = "paralleloptimization";
 
     public static final String ENABLE_OUT_ERR_ELEMENTS_PROP = 
"enableouterrelements";
+
+    public static final String ENABLE_PROPERTIES_ELEMENT_PROP = 
"enablepropertieselement";
 }
diff --git 
a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java
 
b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java
index ec3716deb..694e50b4d 100644
--- 
a/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java
+++ 
b/surefire-extensions-api/src/main/java/org/apache/maven/surefire/extensions/StatelessReportMojoConfiguration.java
@@ -38,19 +38,23 @@ public class StatelessReportMojoConfiguration {
 
     private final boolean enableOutErrElements;
 
+    private final boolean enablePropertiesElement;
+
     public StatelessReportMojoConfiguration(
             File reportsDirectory,
             String reportNameSuffix,
             boolean trimStackTrace,
             int rerunFailingTestsCount,
             String xsdSchemaLocation,
-            boolean enableOutErrElements) {
+            boolean enableOutErrElements,
+            boolean enablePropertiesElement) {
         this.reportsDirectory = reportsDirectory;
         this.reportNameSuffix = reportNameSuffix;
         this.trimStackTrace = trimStackTrace;
         this.rerunFailingTestsCount = rerunFailingTestsCount;
         this.xsdSchemaLocation = xsdSchemaLocation;
         this.enableOutErrElements = enableOutErrElements;
+        this.enablePropertiesElement = enablePropertiesElement;
     }
 
     public File getReportsDirectory() {
@@ -76,4 +80,8 @@ public class StatelessReportMojoConfiguration {
     public boolean isEnableOutErrElements() {
         return enableOutErrElements;
     }
+
+    public boolean isEnablePropertiesElement() {
+        return enablePropertiesElement;
+    }
 }
diff --git 
a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
 
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
index 3e9beca45..51eea78d4 100644
--- 
a/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
+++ 
b/surefire-providers/surefire-junit47/src/main/java/org/apache/maven/surefire/junitcore/JUnitCoreParameters.java
@@ -50,6 +50,8 @@ public final class JUnitCoreParameters {
 
     public static final String ENABLE_OUT_ERR_ELEMENTS_KEY = 
ProviderParameterNames.ENABLE_OUT_ERR_ELEMENTS_PROP;
 
+    public static final String ENABLE_PROPERTIES_ELEMENT_KEY = 
ProviderParameterNames.ENABLE_PROPERTIES_ELEMENT_PROP;
+
     private final String parallel;
 
     private final boolean perCoreThreadCount;
@@ -72,6 +74,8 @@ public final class JUnitCoreParameters {
 
     private final boolean enableOutErrElements;
 
+    private final boolean enablePropertiesElement;
+
     public JUnitCoreParameters(Map<String, String> properties) {
         parallel = property(properties, PARALLEL_KEY, "none").toLowerCase();
         perCoreThreadCount = property(properties, PERCORETHREADCOUNT_KEY, 
true);
@@ -84,6 +88,7 @@ public final class JUnitCoreParameters {
         parallelTestsTimeoutForcedInSeconds = Math.max(property(properties, 
PARALLEL_TIMEOUTFORCED_KEY, 0d), 0);
         parallelOptimization = property(properties, PARALLEL_OPTIMIZE_KEY, 
true);
         enableOutErrElements = property(properties, 
ENABLE_OUT_ERR_ELEMENTS_KEY, true);
+        enablePropertiesElement = property(properties, 
ENABLE_PROPERTIES_ELEMENT_KEY, true);
     }
 
     private static Collection<String> lowerCase(String... elements) {
@@ -173,6 +178,10 @@ public final class JUnitCoreParameters {
         return enableOutErrElements;
     }
 
+    public boolean isEnablePropertiesElement() {
+        return enablePropertiesElement;
+    }
+
     @Override
     public String toString() {
         return "parallel='" + parallel + '\'' + ", perCoreThreadCount=" + 
perCoreThreadCount + ", threadCount="
@@ -180,7 +189,8 @@ public final class JUnitCoreParameters {
                 + threadCountSuites
                 + ", threadCountClasses=" + threadCountClasses + ", 
threadCountMethods=" + threadCountMethods
                 + ", parallelOptimization=" + parallelOptimization
-                + ", enableOutErrElements=" + enableOutErrElements;
+                + ", enableOutErrElements=" + enableOutErrElements
+                + ", enablePropertiesElement=" + enablePropertiesElement;
     }
 
     private static boolean property(Map<String, String> properties, String 
key, boolean fallback) {
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
index c635ca0d5..93e1adf95 100644
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreParametersTest.java
@@ -46,6 +46,7 @@ public class JUnitCoreParametersTest {
         
assertThat(newTestSetDefault().getParallelTestsTimeoutForcedInSeconds(), 
is(0d));
         assertTrue(newTestSetDefault().isParallelOptimization());
         assertTrue(newTestSetDefault().isEnableOutErrElements());
+        assertTrue(newTestSetDefault().isEnablePropertiesElement());
     }
 
     @Test
diff --git 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
index 279a5c405..156cc5ea9 100644
--- 
a/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
+++ 
b/surefire-providers/surefire-junit47/src/test/java/org/apache/maven/surefire/junitcore/JUnitCoreTester.java
@@ -110,6 +110,7 @@ public class JUnitCoreTester {
                 null,
                 false,
                 true,
+                true,
                 new SurefireStatelessReporter(),
                 new SurefireConsoleOutputReporter(),
                 new SurefireStatelessTestsetInfoReporter());

Reply via email to