-
Notifications
You must be signed in to change notification settings - Fork 1
/
collectResults
22 lines (21 loc) · 1003 Bytes
/
collectResults
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
task collectResults() {
def output = file("build/reports/summary.csv")
doLast {
file("build/reports").mkdirs()
output.text = '"Project","Test","Time","Result","Duration"\r\n'
allprojects.each { project2 ->
logger.info("Processing project ${project2.name}")
def resultFiles = project2.fileTree("build") { include '**/TEST-*.xml' }
resultFiles.each { file ->
logger.info("Processing report ${file}")
def testsuite = new XmlSlurper().parse(file)
testsuite.testcase.each { testcase ->
def result = "pass"
if (!testcase.failure.isEmpty()) { result = "fail" }
else if (!testcase.skipped.isEmpty()) { result = "skip" }
output << "\"${project2.name}\",\"${testcase.@classname}.${testcase.@name}\",\"${testcase.@timestamp}\",\"${result}\",\"${testcase.@time}\"\r\n"
}
}
}
}
}