Matthew Layton
Matthew Layton

Reputation: 42350

Gradle - Print test summary on completion of all tests

I am currently using this answer to output detailed information of all tests as they run. Whilst I appreciate the level of detail that I can now see in the console as my tests run, what I would really like is a final test summary; something like this:

--------------
 TEST RESULTS
--------------
PASSED  : 1234
FAILED  :    4
SKIPPED :    1

My current gradle config looks like this:

test {
  useJUnitPlatform()
  finalizedBy jacocoTestReport
}

testlogger {
  theme 'mocha'
}

Should different versions of gradle be an issue affecting the exact implementation of the final test report, running ./gradlew --version yields the following information:

------------------------------------------------------------
Gradle 8.4
------------------------------------------------------------

Build time:   2023-10-04 20:52:13 UTC
Revision:     e9251e572c9bd1d01e503a0dfdf43aedaeecdc3f

Kotlin:       1.9.10
Groovy:       3.0.17
Ant:          Apache Ant(TM) version 1.10.13 compiled on January 4 2023
JVM:          17.0.8 (Azul Systems, Inc. 17.0.8+7-LTS)
OS:           Mac OS X 14.0 x86_64

Is this sort of test summary possible with gradle upon completion of the test task, and if so, how?

Ideally, this should also work when using the --parallel flag.

Upvotes: 1

Views: 229

Answers (0)

Related Questions