Currently the JUnitReport task only logs a warning if it encounters an invalid XML file (see the SAXException catch clause in the createDocument method in XMLResultAggregator). As written, it is impossible to check for this condition within an Ant script. Bug 19113 describes a case where the JUnit task can produce an invalid XML output file. One possibility would be to support an errorproperty parameter (like the one one the JUnit task) that gets set if an error occurs. Another choice (a little less flexible) would be to support a "failOnError" parameter.