/** * Sets message using fluent-api * * @param message to set * @return modified instance */ public TestCasePendingEvent withMessage(String message) { setMessage(message); return this; }
/** * Sets throwable using fluent-api * * @param value to set * @return modified instance */ public TestCasePendingEvent withThrowable(Throwable value) { setThrowable(value); return this; } }
@Override public void result(Result result) { if (match != null) { if (FAILED.equals(result.getStatus())) { this.excuteFailureCallback(); ALLURE_LIFECYCLE.fire(new StepFailureEvent().withThrowable(getError(result))); ALLURE_LIFECYCLE.fire(new TestCaseFailureEvent().withThrowable(getError(result))); currentStatus = FAILED; } else if (SKIPPED.equals(result.getStatus())) { ALLURE_LIFECYCLE.fire(new StepCanceledEvent()); if (PASSED.equals(currentStatus)) { //not to change FAILED status to CANCELED in the report ALLURE_LIFECYCLE.fire(new TestCasePendingEvent()); currentStatus = SKIPPED; } } ALLURE_LIFECYCLE.fire(new StepFinishedEvent()); match = null; } }
@Override public void testIgnored(Description description) throws IllegalAccessException { startFakeTestCase(description); getLifecycle().fire(new TestCasePendingEvent().withMessage(getIgnoredMessage(description))); finishFakeTestCase(); }
private void fireCanceledStep(Step unimplementedStep) { String name = getStepName(unimplementedStep); ALLURE_LIFECYCLE.fire(new StepStartedEvent(name).withTitle(name)); ALLURE_LIFECYCLE.fire(new StepCanceledEvent()); ALLURE_LIFECYCLE.fire(new StepFinishedEvent()); //not to change FAILED status to CANCELED in the report ALLURE_LIFECYCLE.fire(new TestCasePendingEvent() { @Override protected String getMessage() { return "Unimplemented steps were found"; } }); currentStatus = SKIPPED; }
private void addPendingMethods(ITestContext iTestContext) { for (ITestNGMethod method : iTestContext.getExcludedMethods()) { if (method.isTest() && !method.getEnabled() && isInActiveGroup(method, iTestContext)) { Description description = new Description().withValue(method.getDescription()); String suiteUid = getSuiteUid(iTestContext); TestCaseStartedEvent event = new TestCaseStartedEvent(suiteUid, method.getMethodName()); if (description.getValue() != null) { event.setDescription(description); } Annotation[] annotations = method.getConstructorOrMethod().getMethod().getAnnotations(); AnnotationManager am = new AnnotationManager(annotations); am.setDefaults(method.getInstance().getClass().getAnnotations()); am.update(event); getLifecycle().fire(event); getLifecycle().fire(new TestCasePendingEvent()); fireFinishTest(); } } }