@Subscribe public void beginConsequenceCheck() { if (!eventBusInterface.aStepHasFailed()) { eventBusInterface.enableSoftAsserts(); } }
public void reportStepFinished() { if (shouldReportConsequence()) { eventBusInterface.reportStepFinished(); } } }
public void reportStepIgnored() { if (shouldReportConsequence()) { eventBusInterface.reportStepIgnored(); } }
private boolean anOutOfStepErrorOccurred() { if (eventBusInterface.aStepHasFailedInTheCurrentExample()) { return (eventBusInterface.getRunningStepCount()) > taskTally.getPerformedTaskCount(); } else { return false; } }
private boolean anOutOfStepErrorOccurred() { return eventBusInterface.aStepHasFailed() && eventBusInterface.getStepCount() > taskTally.getPerformedTaskCount(); }
private <T extends Performable> void perform(T todo) { if (isPending(todo)) { StepEventBus.getEventBus().stepPending(); } try { notifyPerformanceOf(todo); taskTally.newTask(); todo.performAs(this); if (anOutOfStepErrorOccurred()) { eventBusInterface.mergePreviousStep(); } } catch (Throwable exception) { if (!pendingOrIgnore(exception)) { eventBusInterface.reportStepFailureFor(todo, exception); } if (Serenity.shouldThrowErrorsImmediately() || isAnAssumptionFailure(exception)) { throw exception; } } finally { eventBusInterface.updateOverallResult(); } }
private <T> void check(Consequence<T> consequence) { try { eventBusInterface.reportNewStepWithTitle(FormattedTitle.ofConsequence(consequence)); if (StepEventBus.getEventBus().currentTestIsSuspended() || StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()) { StepEventBus.getEventBus().stepIgnored(); } consequence.evaluateFor(this); eventBusInterface.reportStepFinished(); } catch (IgnoreStepException e) { eventBusInterface.reportStepIgnored(); } catch (Throwable e) { eventBusInterface.reportStepFailureFor(consequence, e); if (Serenity.shouldThrowErrorsImmediately()) { throw e; } } }
void recordError(Consequence<?> consequence, Throwable cause) { errors = errors.append(new FailedConsequence(consequence, cause)); eventBusInterface.reportStepFailureFor(consequence, cause); }
public <T extends Ability> Actor can(T doSomething) { if (doSomething instanceof RefersToActor) { ((RefersToActor)doSomething).asActor(this); } abilities.put(doSomething.getClass(), doSomething); eventBusInterface.assignAbilityToActor(this, doSomething.toString()); return this; }
public static Actor named(String name) { EventBusInterface.castActor(name); return new Actor(name); }
public final void has(Fact... facts) { Arrays.stream(facts).forEach( fact -> { fact.setup(this); eventBusInterface.assignFactToActor(this, fact.toString()); StepEventBus.getEventBus().registerListener(new FactLifecycleListener(this, fact)); } ); }
private <T extends Performable> void perform(T todo) { if (isPending(todo)) { StepEventBus.getEventBus().stepPending(); } try { notifyPerformanceOf(todo); taskTally.newTask(); performTask(todo); if (anOutOfStepErrorOccurred()) { eventBusInterface.mergePreviousStep(); } } catch (Throwable exception) { if (!pendingOrIgnore(exception)) { eventBusInterface.reportStepFailureFor(todo, exception); } if (Serenity.shouldThrowErrorsImmediately() || isAnAssumptionFailure(exception)) { throw exception; } } finally { eventBusInterface.updateOverallResult(); } }