Evaluating a JUnit XML file created outside Gradle


(mprencipe) #1

I have a JUnit XML file that is produced by CasperJS, can I get Gradle to evaluate this file and fail a task based on the results?


(Peter Niederwieser) #2

You’ll have to write a Gradle task that parses the XML. With Groovy’s ‘XmlSlurper’, this is fairly easy to do (once you get the hang of it).


(mprencipe) #3

Ok, thanks a lot.


(mprencipe) #4

By the way, does the Gradle test task currently evaluate the test results by parsing the XML?


(Peter Niederwieser) #5

No, the Gradle test task generates the XML. (Contrary to common belief, JUnit itself doesn’t know anything about XML/HTML reports.)


(mprencipe) #6

I see, thanks for clearing up that misconception.