@Exported(name = "status", visibility = 9) // because stapler notices suffix 's' and remove it public Status getStatus() { if (isSkipped()) { return Status.SKIPPED; } JUnitTestInfo junitTestInfo = getPreviousTestInfo(); if (junitTestInfo == null) { return isPassed() ? Status.PASSED : Status.FAILED; } if (junitTestInfo.getStatus() == JUnitTestInfo.STATUS_SUCCESS) { return isPassed() ? Status.PASSED : Status.REGRESSION; } else { return isPassed() ? Status.FIXED : Status.FAILED; } }
/** * Tests whether the test was skipped or not. TestNG allows tests to be skipped if their * dependencies fail or they are part of a group that has been configured to be skipped. * * @return true if the test was not executed, false otherwise. */ @Exported(visibility = 9) public boolean isSkipped() { return testInfo.getStatus() == JUnitTestInfo.STATUS_SKIP; }
/** @return true if the test was not skipped and did not fail, false otherwise. */ @Override public boolean isPassed() { return testInfo.getStatus() == JUnitTestInfo.STATUS_SUCCESS; }