JUnitResult { public void generateFailsafeSummary() { if (xmlResultDir == null) return; try { Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-8"); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); mkdirs(); File file = new File(xmlResultDir, FAILSAFE_SUMMARY_FILENAME); marshaller.marshal(failsafeSummary, file); log.info("Generated failsafe summary: {}", file); } catch (JAXBException e) { throw new RuntimeException(e); } }  void setCommandLineArgs(String[] args); void setDir(String dir); void startTestSuite(ITestSuite testSuite); void endTestSuite(ITestSuite testSuite); void addProperty(ITestSuite testSuite, String name, String value); void startTestCase(ITestTarget testTarget, ITestCase testCase); void endTestCase(ITestCase testCase); void setSuccess(ITestCase testCase); void setError(ITestCase testCase, String message, String trace); void setFailure(ITestCase testCase, String message, String trace); void generateFailsafeSummary(); static final String FAILSAFE_SUMMARY_FILENAME; }
@Test public void testFailsafeSummaryOnSuccess() throws Exception { jur.generateFailsafeSummary(); dumpFiles(); File summaryFile = new File(tmp.getRoot(), JUnitResult.FAILSAFE_SUMMARY_FILENAME); Element summary = (Element) xpath.evaluate("/failsafe-summary", new InputSource(summaryFile.getPath()), NODE); assertThat("failsafe-summary", summary, is(not(nullValue()))); assertThat("failsafe-summary@result", summary.getAttribute("result"), isEmptyOrNullString()); assertThat("failsafe-summary@timeout", summary.getAttribute("timeout"), is("false")); assertThat("failsafe-summary/completed", (String) getChild(summary, "completed", STRING), is("0")); assertThat("failsafe-summary/errors", (String) getChild(summary, "errors", STRING), is("0")); assertThat("failsafe-summary/failures", (String) getChild(summary, "failures", STRING), is("0")); assertThat("failsafe-summary/skipped", (String) getChild(summary, "skipped", STRING), is("0")); assertThat("failsafe-summary/failureMessage", (String) getChild(summary, "failureMessage", STRING), isEmptyString()); }