Skip to content

Commit

Permalink
Summarize all test failures
Browse files Browse the repository at this point in the history
Signed-off-by: cliu123 <[email protected]>
  • Loading branch information
cliu123 committed Apr 1, 2022
1 parent 00de760 commit c517381
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,28 @@ buildDeb {
arch = 'all'
archiveName "${packageName}-${version}.deb"
}

allprojects {
// add a collection to track failedTests
ext.failedTests = []

// add a testlistener to all tasks of type Test
tasks.withType(Test) {
afterTest { TestDescriptor descriptor, TestResult result ->
if(result.resultType == org.gradle.api.tasks.testing.TestResult.ResultType.FAILURE){
failedTests << ["${descriptor.className}::${descriptor.name}"]
}
}
}

// print out tracked failed tests when the build has finished
gradle.buildFinished {
if(!failedTests.empty){
println "Failed tests for ${project.name}:"
failedTests.each { failedTest ->
println failedTest
}
println ""
}
}
}

0 comments on commit c517381

Please sign in to comment.