Skip to content

Commit fbb6f7b

Browse files
authored
Add option to silence all junit test output and rely on summary outputs for test status (#926)
1 parent e8fb7f5 commit fbb6f7b

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

BUILDING.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,16 @@ as for the property "test.name".
529529
This is configured by setting "test.threads" property. The recommended
530530
value is one thread per core.
531531

532-
6. Optional support is provided for the Cobertura code coverage tool.
532+
6. Test output can be suppressed for cleaner console output, especially useful
533+
when running tests with multiple threads:
534+
535+
ant test -Dtest.silent=true
536+
537+
This suppresses JUnit console output while still saving all test results to
538+
individual log files in output/build/logs. The test-status target will still
539+
display a summary of any failures or skipped tests.
540+
541+
7. Optional support is provided for the Cobertura code coverage tool.
533542

534543
NOTE: Cobertura is licensed under GPL v2 with parts of it being under
535544
Apache License v1.1. See https://cobertura.github.io/cobertura/ for details.

build.properties.default

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ test.haltonfailure=false
7575
test.accesslog=false
7676
# Display the tests output on the console
7777
test.verbose=true
78+
# Suppress JUnit console output (useful for parallel testing)
79+
test.silent=false
7880

7981
# Number of parallel threads to use for testing. The recommended value is one
8082
# thread per core.

build.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,6 +1942,14 @@
19421942
<property name="junit.formatter.usefile" value="true" />
19431943
<property name="junit.formatter.extension" value=".txt" />
19441944

1945+
<!-- Configure JUnit output based on test.silent property -->
1946+
<condition property="junit.printsummary" value="off" else="yes">
1947+
<istrue value="${test.silent}"/>
1948+
</condition>
1949+
<condition property="junit.showoutput" value="false" else="${test.verbose}">
1950+
<istrue value="${test.silent}"/>
1951+
</condition>
1952+
19451953
<!-- ==================== Test Profile System ==================== -->
19461954
<!--
19471955
Property-based test profiles for convenient, selective test execution.
@@ -2129,7 +2137,7 @@
21292137
enabled="${test.coverage}"
21302138
destfile="${coverage.datafile}"
21312139
>
2132-
<junit printsummary="yes" fork="yes" dir="." showoutput="${test.verbose}"
2140+
<junit printsummary="${junit.printsummary}" fork="yes" dir="." showoutput="${junit.showoutput}"
21332141
errorproperty="test.result.error"
21342142
failureproperty="test.result.failure"
21352143
haltonfailure="${test.haltonfailure}"

webapps/docs/changelog.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@
114114
<update>
115115
The minimum Java version has been updated to Java 21. (markt)
116116
</update>
117+
<add>
118+
Add <code>test.silent</code> property to suppress JUnit console output
119+
during test execution. Useful for cleaner console output when running
120+
tests with multiple threads. (csutherl)
121+
</add>
117122
</changelog>
118123
</subsection>
119124
<subsection name="Catalina">

0 commit comments

Comments
 (0)