private Element buildTestSuiteElement(Document doc, String testCaseName, TestOutcomes testCaseOutcomes) { int errors = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.ERROR); int failures = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.FAILURE); int success = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.SUCCESS); int skipped = testCaseOutcomes.getTotal() - errors - failures - success; Element testSuiteElement = doc.createElement("testsuite"); testSuiteElement.setAttribute("name", testCaseName); testSuiteElement.setAttribute("time", Double.toString(testCaseOutcomes.getDurationInSeconds())); testSuiteElement.setAttribute("tests", Integer.toString(testCaseOutcomes.getTestCount())); testSuiteElement.setAttribute("errors", Integer.toString(errors)); testSuiteElement.setAttribute("skipped", Integer.toString(skipped)); testSuiteElement.setAttribute("failures", Integer.toString(failures)); if (testCaseOutcomes.getStartTime() != null) { testSuiteElement.setAttribute("timestamp", testCaseOutcomes.getStartTime().toString("YYYY-MM-DD hh:mm:ss")); } return testSuiteElement; } }
private Element buildTestSuiteElement(Document doc, String testCaseName, TestOutcomes testCaseOutcomes) { int errors = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.ERROR); int failures = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.FAILURE); int success = testCaseOutcomes.count(TestType.ANY).withResult(TestResult.SUCCESS); int skipped = testCaseOutcomes.getTotal() - errors - failures - success; Element testSuiteElement = doc.createElement("testsuite"); testSuiteElement.setAttribute("name", testCaseName); testSuiteElement.setAttribute("time", Double.toString(testCaseOutcomes.getDurationInSeconds())); testSuiteElement.setAttribute("tests", Integer.toString(testCaseOutcomes.getTestCount())); testSuiteElement.setAttribute("errors", Integer.toString(errors)); testSuiteElement.setAttribute("skipped", Integer.toString(skipped)); testSuiteElement.setAttribute("failures", Integer.toString(failures)); testCaseOutcomes.getStartTime().ifPresent( startTime -> testSuiteElement.setAttribute("timestamp", TIMESTAMP_FORMAT.format(startTime)) ); return testSuiteElement; } }