October 2018
Intermediate to advanced
192 pages
5h 12m
English
The following code shows how to generate the Excel report:
public class ReportGenerator { public static void main(String[] args) throws ParserConfigurationException, SAXException, IOException { String destFile = "ReportGen.xls"; String path = ReportGenerator.class.getClassLoader().getResource("./") .getPath(); path = path.replaceAll("target/classes", "test-output"); File file = new File(path + "testng-results.xml"); DocumentBuilderFactory docFactory = DocumentBuilderFactory .newInstance(); DocumentBuilder docbuilder = docFactory.newDocumentBuilder(); Document dcmt = docbuilder.parse(file); dcmt.getDocumentElement().normalize(); XSSFWorkbook book = new XSSFWorkbook(); NodeList tlist = dcmt.getElementsByTagName("test"); ...Read now
Unlock full access