File tree Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Expand file tree Collapse file tree 1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -219,16 +219,18 @@ task failOnTestError() {
219
219
description ' evaluate junit result and fail on error'
220
220
doLast {
221
221
222
- def junitResult = new XmlSlurper (). parse(file(' TESTS-TestSuites.xml' ))
223
- def failures = junitResult. ' **' . findAll { it. name() == ' failure' }
224
- def errors = junitResult. ' **' . findAll { it. name() == ' errors' }
225
-
226
- if (failures || errors) {
227
- def amount = failures. size() + errors. size()
228
- throw new GradleException (amount + " JUnit tests failed. Check the test report for details." )
222
+ def juniXml = file(' TESTS-TestSuites.xml' )
223
+ if (juniXml. exists()){
224
+ def junitResult = new XmlSlurper (). parse(juniXml)
225
+ def failures = junitResult. ' **' . findAll { it. name() == ' failure' }
226
+ def errors = junitResult. ' **' . findAll { it. name() == ' errors' }
227
+
228
+ if (failures || errors) {
229
+ def amount = failures. size() + errors. size()
230
+ throw new GradleException (amount + " JUnit tests failed. Check the test report for details." )
231
+ }
229
232
}
230
233
}
231
-
232
234
}
233
235
buildAndRunTests. configure { finalizedBy failOnTestError }
234
236
check. dependsOn buildAndRunTests
You can’t perform that action at this time.
0 commit comments