public StepEventBus getEventBus() { if (eventBus == null) { eventBus = StepEventBus.getEventBus(); } return eventBus; }
public StepEventBus getEventBus() { if (eventBus == null) { eventBus = StepEventBus.getEventBus(); } return eventBus; }
private boolean aPreviousStepHasFailed() { boolean aPreviousStepHasFailed = false; if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()) { aPreviousStepHasFailed = true; } return aPreviousStepHasFailed; }
private boolean aPreviousStepHasFailed() { boolean aPreviousStepHasFailed = false; if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed()) { aPreviousStepHasFailed = true; } return aPreviousStepHasFailed; }
public void dropListeners() { StepEventBus.getEventBus().dropListener(baseStepListener); for(StepListener listener : extraListeners) { StepEventBus.getEventBus().dropListener(listener); } }
private boolean shouldTakeScreenshots() { if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed() && !StepEventBus.getEventBus().softAssertsActive()) { return false; } return (currentStepExists() && browserIsOpen() && !StepEventBus.getEventBus().isDryRun() && !StepEventBus.getEventBus().currentTestIsSuspended()); }
private void checkForAssumptionViolations() { if (StepEventBus.getEventBus().assumptionViolated()) { throw new AssumptionViolatedException(StepEventBus.getEventBus().getAssumptionViolatedMessage()); } } }
private void registerStoryTags(Meta metaData) { List<TestTag> tags = getTagOrTagsPropertyValues(metaData); if (!tags.isEmpty()) { StepEventBus.getEventBus().addTagsToCurrentStory(tags); } }
@Override public void testRunFinished(Result result) throws Exception { StepEventBus.getEventBus().testRunFinished(); super.testRunFinished(result); }
private void registerStoryMeta(Meta metaData) { if (isPending(metaData)) { StepEventBus.getEventBus().suspendTest(); } else if (isSkipped(metaData)) { StepEventBus.getEventBus().suspendTest(); } else if (isIgnored(metaData)) { StepEventBus.getEventBus().suspendTest(); } else if (isManual(metaData)) { StepEventBus.getEventBus().suspendTest(); } }
public void assignFactToActor(Actor actor, String fact) { if (!StepEventBus.getEventBus().isBaseStepListenerRegistered()) { return; } StepEventBus.getEventBus().getBaseStepListener().latestTestOutcome().ifPresent( testOutcome -> testOutcome.assignFact(actor.getName(), fact) ); }
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 long getLocatorTimeout() { if (StepEventBus.getEventBus().aStepInTheCurrentTestHasFailed() || (MethodTiming.forThisThread().isInQuickMethod())) { return 0; } else { return TimeUnit.SECONDS.convert(implicitTimeoutInMilliseconds, TimeUnit.MILLISECONDS); } }
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(); } }
@Override public void testIgnored(final Description description) throws Exception { if (testingThisTest(description)) { StepEventBus.getEventBus().testIgnored(); endTest(); } }
public static void clearBrowserSession(WebDriver driver) { if (StepEventBus.getEventBus().isDryRun()) { return; } if (((WebDriverFacade) driver).isInstantiated()) { driver.manage().deleteAllCookies(); try { ((JavascriptExecutor) driver).executeScript(String.format("window.localStorage.clear();")); } catch (WebDriverException driverDoesntSupportJavascriptTooBad) {} } } }
@Override public void testStarted(final Description description) { if (testingThisDataSet(description)) { super.testStarted(description); StepEventBus.getEventBus().useExamplesFrom(dataTableRow()); //StepEventBus.getEventBus().useExamplesFrom(dataTable()); if (!ignoredOrPending(description)) StepEventBus.getEventBus().exampleStarted(parametersTable.row(parameterSetNumber).toStringMap()); } }
@Override public void testIgnored(final Description description) throws Exception { if (testingThisDataSet(description)) { super.testIgnored(description); if (!ignoredOrPending(description)){ StepEventBus.getEventBus().exampleFinished(); } } }
/** * Process any Thucydides annotations in the test class. * Ignored tests will just be skipped by JUnit - we need to ensure * that they are included in the Thucydides reports * If a test method is pending, all the steps should be skipped. */ private void processTestMethodAnnotationsFor(FrameworkMethod method) { if (isIgnored(method)) { stepListener.testStarted(Description.createTestDescription(method.getMethod().getDeclaringClass(), testName(method))); StepEventBus.getEventBus().testIgnored(); } }
@Override public void example(Map<String, String> tableRow) { StepEventBus.getEventBus().clearStepFailures(); if (givenStoryMonitor.isInGivenStory()) { return; } if (executingExamples()) { finishExample(); } exampleCount++; startExample(tableRow); }