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

csutherl pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tomcat.git


The following commit(s) were added to refs/heads/main by this push:
     new fbb6f7bef4 Add option to silence all junit test output and rely on 
summary outputs for test status (#926)
fbb6f7bef4 is described below

commit fbb6f7bef4804d605e58253685b8b9639e5c7851
Author: Coty Sutherland <[email protected]>
AuthorDate: Tue Dec 2 14:49:32 2025 -0500

    Add option to silence all junit test output and rely on summary outputs for 
test status (#926)
---
 BUILDING.txt               | 11 ++++++++++-
 build.properties.default   |  2 ++
 build.xml                  | 10 +++++++++-
 webapps/docs/changelog.xml |  5 +++++
 4 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/BUILDING.txt b/BUILDING.txt
index 7f4eef26b6..e0fdba1eb3 100644
--- a/BUILDING.txt
+++ b/BUILDING.txt
@@ -529,7 +529,16 @@ as for the property "test.name".
  This is configured by setting "test.threads" property. The recommended
  value is one thread per core.
 
- 6. Optional support is provided for the Cobertura code coverage tool.
+ 6. Test output can be suppressed for cleaner console output, especially useful
+ when running tests with multiple threads:
+
+        ant test -Dtest.silent=true
+
+ This suppresses JUnit console output while still saving all test results to
+ individual log files in output/build/logs. The test-status target will still
+ display a summary of any failures or skipped tests.
+
+ 7. Optional support is provided for the Cobertura code coverage tool.
 
 NOTE: Cobertura is licensed under GPL v2 with parts of it being under
       Apache License v1.1. See https://cobertura.github.io/cobertura/ for 
details.
diff --git a/build.properties.default b/build.properties.default
index 15210a29ae..ce314bf5bb 100644
--- a/build.properties.default
+++ b/build.properties.default
@@ -75,6 +75,8 @@ test.haltonfailure=false
 test.accesslog=false
 # Display the tests output on the console
 test.verbose=true
+# Suppress JUnit console output (useful for parallel testing)
+test.silent=false
 
 # Number of parallel threads to use for testing. The recommended value is one
 # thread per core.
diff --git a/build.xml b/build.xml
index 0dba1d5125..e48c35494d 100644
--- a/build.xml
+++ b/build.xml
@@ -1942,6 +1942,14 @@
   <property name="junit.formatter.usefile" value="true" />
   <property name="junit.formatter.extension" value=".txt" />
 
+  <!-- Configure JUnit output based on test.silent property -->
+  <condition property="junit.printsummary" value="off" else="yes">
+    <istrue value="${test.silent}"/>
+  </condition>
+  <condition property="junit.showoutput" value="false" else="${test.verbose}">
+    <istrue value="${test.silent}"/>
+  </condition>
+
   <!-- ==================== Test Profile System ==================== -->
   <!--
     Property-based test profiles for convenient, selective test execution.
@@ -2129,7 +2137,7 @@
           enabled="${test.coverage}"
           destfile="${coverage.datafile}"
           >
-        <junit printsummary="yes" fork="yes" dir="." 
showoutput="${test.verbose}"
+        <junit printsummary="${junit.printsummary}" fork="yes" dir="." 
showoutput="${junit.showoutput}"
           errorproperty="test.result.error"
           failureproperty="test.result.failure"
           haltonfailure="${test.haltonfailure}"
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 9ec05d1cfa..1956fc1415 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -114,6 +114,11 @@
       <update>
         The minimum Java version has been updated to Java 21. (markt)
       </update>
+      <add>
+        Add <code>test.silent</code> property to suppress JUnit console output
+        during test execution. Useful for cleaner console output when running
+        tests with multiple threads. (csutherl)
+      </add>
     </changelog>
   </subsection>
   <subsection name="Catalina">


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to