public List<ITestUnit> getFilteredTestUnits(boolean failuresOnly, int size) { if (testUnits != null && failuresOnly) { List<ITestUnit> failedUnits = new ArrayList<>(); for (ITestUnit testUnit : testUnits) { if (testUnit.getResultStatus() != TestStatus.TR_OK // Failed unit && (failedUnits.size() < size || size == -1)) { failedUnits.add(testUnit); } } return failedUnits; } return testUnits; }
public int getNumberOfErrors() { int cnt = 0; for (int i = 0; i < getNumberOfTestUnits(); i++) { if (testUnits.get(i).getResultStatus() == TestStatus.TR_EXCEPTION) { ++cnt; } } return cnt; }
public int getNumberOfAssertionFailures() { int cnt = 0; for (int i = 0; i < getNumberOfTestUnits(); i++) { if (testUnits.get(i).getResultStatus() == TestStatus.TR_NEQ) { ++cnt; } } return cnt; }
public int getNumberOfFailures() { int cnt = 0; for (int i = 0; i < getNumberOfTestUnits(); i++) { if (testUnits.get(i).getResultStatus() != TestStatus.TR_OK) { ++cnt; } } return cnt; }
private void writeErrorOrFailureElement(ITestUnit test) throws XMLStreamException { TestStatus testStatus = test.getResultStatus(); switch (testStatus) { case TR_OK: break; case TR_NEQ: start("failure"); attr("type", "ComparisonFailure"); writeCData(failureMessage(test)); end(); break; case TR_EXCEPTION: Throwable throwable = (Throwable) test.getActualResult(); start("error"); attr("type", throwable.getClass().getName()); attr("message", throwable.getMessage()); writeCData(ExceptionUtils.getStackTrace(throwable)); end(); break; default: throw new IllegalArgumentException("Unexpected TestStatus." + testStatus.name()); } }
private void writeTestcase(String testName, ITestUnit test) throws XMLStreamException { if (test.getResultStatus() == TR_OK) { empty("testcase"); } else { start("testcase"); } attr("name", test.getTest().getId()); attr("classname", testName); attr("time", getTime(test.getExecutionTime())); writeErrorOrFailureElement(test); if (test.getResultStatus() != TR_OK) { end(); } }
private void writeErrorOrFailureElement(ITestUnit test) throws XMLStreamException { TestStatus testStatus = test.getResultStatus(); switch (testStatus) { case TR_OK: break; case TR_NEQ: start("failure"); attr("type", "ComparisonFailure"); writeCData(failureMessage(test)); end(); break; case TR_EXCEPTION: Throwable throwable = (Throwable) test.getActualResult(); start("error"); attr("type", throwable.getClass().getName()); attr("message", throwable.getMessage()); writeCData(ExceptionUtils.getStackTrace(throwable)); end(); break; default: throw new IllegalArgumentException("Unexpected TestStatus." + testStatus.name()); } }
private void writeTestcase(String testName, ITestUnit test) throws XMLStreamException { if (test.getResultStatus() == TR_OK) { empty("testcase"); } else { start("testcase"); } attr("name", test.getTest().getId()); attr("classname", testName); attr("time", getTime(test.getExecutionTime())); writeErrorOrFailureElement(test); if (test.getResultStatus() != TR_OK) { end(); } }
TestStatus status = testUnit.getResultStatus(); if (status != TR_OK) { String failureType = status == TR_NEQ ? FAILURE : ERROR;
TestStatus status = testUnit.getResultStatus(); if (status != TR_OK) { String failureType = status == TR_NEQ ? FAILURE : ERROR;
boolean hasExpected = result.hasExpected(); for (ITestUnit testUnit : result.getTestUnits()) { TestStatus testStatus = hasExpected ? testUnit.getResultStatus() : TestStatus.TR_OK; boolean ok = testStatus == TestStatus.TR_OK;