generateFailureSuite(xmlSuites.get(i), suites.get(i), outputDirectory);
}
}
protected void generateFailureSuite(XmlSuite xmlSuite, ISuite suite, String outputDir) {
XmlSuite failedSuite = (XmlSuite) xmlSuite.clone();
failedSuite.setName("Failed suite [" + xmlSuite.getName() + "]");
m_xmlSuite= failedSuite;
Map<String, XmlTest> xmlTests= new HashMap<String, XmlTest>();
for(XmlTest xmlT: xmlSuite.getTests()) {
xmlTests.put(xmlT.getName(), xmlT);
}
Map<String, ISuiteResult> results= suite.getResults();
for(String name: results.keySet()) {
ISuiteResult suiteResult= results.get(name);
ITestContext testContext= suiteResult.getTestContext();
generateXmlTest(suite,
xmlTests.get(testContext.getName()),
testContext,
testContext.getFailedTests().getAllResults(),
testContext.getSkippedTests().getAllResults());
}
if(null != failedSuite.getTests() && failedSuite.getTests().size() > 0) {
Utils.writeUtf8File(outputDir, TESTNG_FAILED_XML, failedSuite.toXml());
Utils.writeUtf8File(suite.getOutputDirectory(), TESTNG_FAILED_XML, failedSuite.toXml());
}
}