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 e86fd54f5e840022064952ebe8a65b3fd0a1eac2
Author: Michael Osipov <[email protected]>
AuthorDate: Mon Jul 1 23:04:10 2024 +0200

    Let's try
---
 .../surefire/report/StatelessXmlReporter.java      | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

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..4c8e27e71 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 = false;
+
     public StatelessXmlReporter(
             File reportsDirectory,
             String reportNameSuffix,
@@ -158,7 +160,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 :

Reply via email to