Reputation: 207
I need a bit of help building custom test reports.
Each test would have an output like 'result x', 'result y' which would then be stored in either 1 global report file or 1 report per test.
A naive approach would be to use the 'tear down' part of each test to append the info in a global file.
The output file shouldn't interfere with junit, jacoco or other reports.
Can this be achieved by doing a custom gradle plugin or reusing some functionality in other plugins?
Thank you
Upvotes: 0
Views: 2308
Reputation: 28016
The gradle Test task supports custom TestListeners. There's also convenience methods for beforeTest and afterTest
eg:
apply plugin: 'java'
test {
afterTest { TestDescriptor td, TestResult tr ->
writeToSomeFile(td.className, td.name, tr.resultType.name())
}
}
Upvotes: 0