@Override public void comment(String step) { StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(step)); StepEventBus.getEventBus().stepIgnored(); }
private void notifyStepFinishedFor(final Method method, final Object[] args) { StepEventBus.getEventBus().stepFinished(); }
private void notifyStepSkippedFor(final Method method, final Object[] args) { if (isPending(method)) { StepEventBus.getEventBus().stepPending(); } else { StepEventBus.getEventBus().stepIgnored(); } }
public TestCase<T> finish() { if (!finished) { StepEventBus.getEventBus().testFinished(); this.finished = true; } return this; }
private boolean aPreviousStepHasFailed() { boolean aPreviousStepHasFailed = false; if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()) { aPreviousStepHasFailed = true; } return aPreviousStepHasFailed; }
public void testStarted(final String newTestName, final Class<?> testClass) { ensureThatTheTestSuiteStartedWith(testClass); if (newTestName != null) { testStarted(newTestName); } }
public void reportStepFailureFor(Performable todo, Throwable e) { ExecutedStepDescription taskDescription = ExecutedStepDescription.of(todo.getClass(),"attemptsTo"); StepEventBus.getEventBus().stepFailed(new StepFailure(taskDescription, e)); }
private void recordStepResult(Result result, Step currentStep, TestStep currentTestStep) { if (StepEventBus.getEventBus().currentTestIsSuspended()) { getStepEventBus(currentFeaturePath()).stepIgnored(); } else if (Result.Type.PASSED.equals(result.getStatus())) { getStepEventBus(currentFeaturePath()).stepFinished(); } else if (Result.Type.FAILED.equals(result.getStatus())) { failed(stepTitleFrom(currentStep, currentTestStep), result.getError()); } else if (Result.Type.SKIPPED.equals(result.getStatus())) { getStepEventBus(currentFeaturePath()).stepIgnored(); } else if (Result.Type.PENDING.equals(result.getStatus())) { getStepEventBus(currentFeaturePath()).stepPending(); } else if (Result.Type.SKIPPED.equals(result.getStatus())) { getStepEventBus(currentFeaturePath()).stepIgnored(); } else if (Result.Type.UNDEFINED.equals(result.getStatus())) { getStepEventBus(currentFeaturePath()).stepPending(); } }
public void failed(String stepTitle, Throwable cause) { Throwable rootCause = cause.getCause() != null ? cause.getCause() : cause; StepEventBus.getEventBus().updateCurrentStepTitle(stepTitle); if (isAssumptionFailure(rootCause)) { StepEventBus.getEventBus().assumptionViolated(rootCause.getMessage()); } else { StepEventBus.getEventBus().stepFailed(new StepFailure(ExecutedStepDescription.withTitle(normalized(stepTitle)), rootCause)); } }
private void notifyAssumptionViolated(String message) { StepEventBus.getEventBus().assumptionViolated(message); }
private void processAnnotatedResult() { TestResult forcedResult = StepEventBus.getEventBus().getForcedResult().get(); switch (forcedResult) { case PENDING: StepEventBus.getEventBus().stepPending(); break; case IGNORED: StepEventBus.getEventBus().stepIgnored(); break; case SKIPPED: StepEventBus.getEventBus().stepIgnored(); break; default: StepEventBus.getEventBus().stepIgnored(); } }
@Override public void pending(String stepTitle) { StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(normalized(stepTitle))); StepEventBus.getEventBus().stepPending(); }
private Optional<TakeScreenshots> classOverride() { if (StepEventBus.getEventBus().isBaseStepListenerRegistered()) { Optional<Method> currentStepMethod = StepEventBus.getEventBus().getBaseStepListener().getCurrentStepMethod(); if (currentStepMethod != null && currentStepMethod.isPresent()) { return overriddenScreenshotPreferenceForClass(currentStepMethod.get().getDeclaringClass()); } } return Optional.empty(); }
private boolean shouldTakeScreenshots() { if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed() && !StepEventBus.getEventBus().softAssertsActive()) { return false; } return (currentStepExists() && browserIsOpen() && !StepEventBus.getEventBus().isDryRun() && !StepEventBus.getEventBus().currentTestIsSuspended()); }
public void afterScenario() { if (givenStoryMonitor.isInGivenStory() || shouldNestScenarios()) { StepEventBus.getEventBus().stepFinished(); } else { StepEventBus.getEventBus().testFinished(); if (isPendingScenario() || isPendingStory()) { StepEventBus.getEventBus().setAllStepsTo(TestResult.PENDING); } if (isSkippedScenario() || isSkippedStory()) { StepEventBus.getEventBus().setAllStepsTo(TestResult.SKIPPED); } activeScenarios.pop(); } }
private void startNewStep(String scenarioTitle) { if (givenStoryMonitor.isInGivenStory() && StepEventBus.getEventBus().areStepsRunning()) { StepEventBus.getEventBus().updateCurrentStepTitle(scenarioTitle); } else { StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(scenarioTitle)); } }
public final void should(String groupStepName, Consequence... consequences) { try { String groupTitle = injectActorInto(groupStepName); StepEventBus.getEventBus().stepStarted(ExecutedStepDescription.withTitle(groupTitle)); should(consequences); } catch (Throwable error) { throw error; } finally { StepEventBus.getEventBus().stepFinished(); } }
private void notifyStepIgnored(String message) { StepEventBus.getEventBus().stepIgnored(); }
private void notifyStepPending(String message) { StepEventBus.getEventBus().stepPending(message); }
private void markAsPending(FrameworkMethod method) { stepListener.testStarted(Description.createTestDescription(method.getMethod().getDeclaringClass(), testName(method))); StepEventBus.getEventBus().testPending(); StepEventBus.getEventBus().testFinished(); }