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

shunping pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new a1e128896fc Add -PshowTests to print each test as it runs in gradle 
(#40147)
a1e128896fc is described below

commit a1e128896fc33f01e4ad8eec9e0aae68918614e1
Author: Shunping Huang <[email protected]>
AuthorDate: Thu Sep 17 11:15:51 2026 -0400

    Add -PshowTests to print each test as it runs in gradle (#40147)
    
    * Add -PshowTests to print each test as it runs
    
    Gradle logs only failed tests by default, and only failed/skipped at
    --info. A passing run therefore prints nothing but "BUILD SUCCESSFUL"
    and gives no indication of which tests --tests actually selected. That
    is easy to misread: a filter matching nothing, or a task restored from
    the build cache, looks identical to a real run. PASSED is otherwise
    only available at --debug, which is unusably noisy.
    
    With the fix here, we can choose to print out tests even if they
    run successfully, which avoids having to dig through
    build/test-results/**/TEST-*.xml. Without the property the build is
    unchanged.
    
    * Make per-test reporting the default, gate only test output
---
 .../org/apache/beam/gradle/BeamModulePlugin.groovy | 24 ++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git 
a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy 
b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
index d76180a5eec..88c998ed910 100644
--- a/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
+++ b/buildSrc/src/main/groovy/org/apache/beam/gradle/BeamModulePlugin.groovy
@@ -1263,6 +1263,30 @@ class BeamModulePlugin implements Plugin<Project> {
         if (System.getProperty("os.name").toLowerCase().contains("windows")) {
           systemProperty 'org.xerial.snappy.tempdir', 
System.getProperty('org.xerial.snappy.tempdir') ?: 
"${project.rootDir.absolutePath}/build/snappy_bin"
         }
+        // Report each test as it runs, plus a per-task summary. Gradle logs 
only
+        // failures by default, so a passing run prints nothing but "BUILD 
SUCCESSFUL"
+        // and gives no indication of which tests --tests actually selected.
+        // Test stdout/stderr stays off unless asked for, since it is noisy:
+        //   -PshowTestOutput   also forward test stdout/stderr
+        // A cached or up-to-date test task forks no JVM and prints nothing;
+        // add --no-build-cache --rerun to force real execution.
+        testLogging {
+          events 'passed', 'skipped', 'failed'
+          exceptionFormat = 'full'
+          showExceptions = true
+          showCauses = true
+          showStackTraces = true
+          showStandardStreams = project.hasProperty('showTestOutput')
+          displayGranularity = 0
+        }
+        afterSuite { desc, result ->
+          // Only the root suite of each test task, to get one summary per 
task.
+          if (!desc.parent) {
+            println "RESULT [${path}]: ${result.resultType} - 
${result.testCount} tests, " +
+                "${result.successfulTestCount} passed, 
${result.failedTestCount} failed, " +
+                "${result.skippedTestCount} skipped"
+          }
+        }
       }
 
       // NOTE: Use the character class "[.]" instead of an escaped "\\." to 
match a literal dot in

Reply via email to