public void castActor(String name) { if ((baseStepListener != null) && (baseStepListener.latestTestOutcome() != null)) { baseStepListener.latestTestOutcome().ifPresent( testOutcome -> testOutcome.castActor(name) ); } } }
protected TestOutcome getCurrentTestOutcome() { Preconditions.checkState(!testOutcomes.isEmpty()); return latestTestOutcome().get(); }
protected TestOutcome getCurrentTestOutcome() { return latestTestOutcome().orElse(unavailableTestOutcome()); }
public java.util.Optional<TestResult> resultSoFar() { return (getBaseStepListener().latestTestOutcome().isPresent()) ? java.util.Optional.ofNullable(getBaseStepListener().latestTestOutcome().get().getResult()) : NO_RESULT_YET; }
public boolean currentTestOutcomeIsDataDriven() { return (getBaseStepListener().latestTestOutcome().isPresent() && getBaseStepListener().latestTestOutcome().get().isDataDriven()); } /**
public boolean currentTestOutcomeIsDataDriven() { return (getBaseStepListener().latestTestOutcome().isPresent() && getBaseStepListener().latestTestOutcome().get().isDataDriven()); } /**
public void lastTestPassedAfterRetries(int remainingTries, List<String> failureMessages,TestFailureCause testfailureCause) { if (latestTestOutcome().isPresent()) { latestTestOutcome().get().recordStep( TestStep.forStepCalled("UNSTABLE TEST:\n" + failureHistoryFor(failureMessages)) .withResult(TestResult.IGNORED)); latestTestOutcome().get().addTag(TestTag.withName("Retries: " + (remainingTries - 1)). andType("unstable test")); latestTestOutcome().get().setFlakyTestFailureCause(testfailureCause); } }
public void useScenarioOutline(String scenarioOutline) { getBaseStepListener().latestTestOutcome().ifPresent( testOutcome -> testOutcome.useScenarioOutline(scenarioOutline) ); }
public void exampleFinished() { if (newStepForEachExample()) { currentStepDone(null); } if (latestTestOutcome().isPresent()) { latestTestOutcome().get().moveToNextRow(); } closeBrowsers.forTestSuite(testSuite).closeIfConfiguredForANew(EXAMPLE); }
private boolean newStepForEachExample() { if (!latestTestOutcome().isPresent()) { return false; } return (getCurrentTestOutcome().getTestSource() != null) && (!getCurrentTestOutcome().getTestSource().equalsIgnoreCase("junit")); }
public void assignDescriptionToActor(String description) { StepEventBus.getEventBus().getBaseStepListener().latestTestOutcome().ifPresent( testOutcome -> testOutcome.assignDescriptionToActor(getName(), description) ); } }
public void assignAbilityToActor(Actor actor, String ability) { if (!StepEventBus.getEventBus().isBaseStepListenerRegistered()) { return; } if (StepEventBus.getEventBus().getBaseStepListener().latestTestOutcome() == null) { return; } StepEventBus.getEventBus().getBaseStepListener().latestTestOutcome().ifPresent( testOutcome -> testOutcome.assignAbility(actor.getName(), ability) ); }
private void recordStep(ExecutedStepDescription description) { if (!latestTestOutcome().isPresent()) { return; } TestStep step = new TestStep(AnnotatedStepDescription.from(description).getName()); startNewGroupIfNested(); setDefaultResultFromAnnotations(step, description); currentStepStack.push(step); recordStepToCurrentTestOutcome(step); }
@Override public void andContents(String contents) { eventBus.getBaseStepListener().latestTestOutcome().ifPresent( outcome -> outcome.currentStep().get().withReportData(ReportData.withTitle(title).andContents(contents).asEvidence(isEvidence)) ); }
@Override public void fromFile(Path source, Charset encoding) throws IOException { Optional<TestOutcome> outcome = eventBus.getBaseStepListener().latestTestOutcome(); if (outcome.isPresent()) { ReportData reportData = (fileIsDownloadable) ? ReportData.withTitle(title).fromPath(source).asEvidence(isEvidence) : ReportData.withTitle(title).fromFile(source, encoding).asEvidence(isEvidence); outcome.get().currentStep().get().withReportData(reportData); } }
public void assignFactToActor(Actor actor, String fact) { if (!StepEventBus.getEventBus().isBaseStepListenerRegistered()) { return; } StepEventBus.getEventBus().getBaseStepListener().latestTestOutcome().ifPresent( testOutcome -> testOutcome.assignFact(actor.getName(), fact) ); }
private void updateManualResultsFrom(List<Tag> scenarioTags) { getStepEventBus(currentFeaturePath()).testIsManual(); manualResultDefinedIn(scenarioTags).ifPresent( result -> { if (result == TestResult.FAILURE) { String failureMessage = failureMessageFrom(currentScenarioDefinition.getDescription()).orElse("Failed manual test"); getStepEventBus(currentFeaturePath()).getBaseStepListener() .latestTestOutcome().ifPresent( outcome -> outcome.setTestFailureMessage(failureMessage)); } getStepEventBus(currentFeaturePath()).getBaseStepListener().overrideResultTo(result); } ); }
private void updateManualResultsFrom(List<Tag> scenarioTags) { getStepEventBus(currentFeaturePath()).testIsManual(); manualResultDefinedIn(scenarioTags).ifPresent( result -> { if (result == TestResult.FAILURE) { String failureMessage = failureMessageFrom(currentScenarioDefinition.getDescription()).orElse("Failed manual test"); getStepEventBus(currentFeaturePath()).getBaseStepListener() .latestTestOutcome().ifPresent( outcome -> outcome.setTestFailureMessage(failureMessage)); } getStepEventBus(currentFeaturePath()).getBaseStepListener().overrideResultTo(result); } ); }