Search in sources :

Example 1 with PendingStepFound

use of org.jbehave.core.failures.PendingStepFound in project jbehave-core by jbehave.

the class StepResultBehaviour method shouldDescribeResultToReporter.

@Test
public void shouldDescribeResultToReporter() {
    // Given
    StoryReporter reporter = mock(StoryReporter.class);
    // When
    String successful = "Given that a step is pending or failing";
    successful(successful).describeTo(reporter);
    String pending = "When a step is performed";
    pending(pending).describeTo(reporter);
    PendingStepFound pendingStepFound = new PendingStepFound(pending);
    pending(pending, pendingStepFound).describeTo(reporter);
    String notPerformed = "Then the step should describe itself properly to reporters";
    notPerformed(notPerformed).describeTo(reporter);
    String ignorable = "!-- Then ignore me";
    ignorable(ignorable).describeTo(reporter);
    String comment = "!-- this is a comment";
    comment(comment).describeTo(reporter);
    String failed = "And any errors should appear at the end of the story";
    UUIDExceptionWrapper cause = new UUIDExceptionWrapper(new IllegalStateException());
    failed(failed, cause).describeTo(reporter);
    String failedOutcomes = "And outcomes failed";
    OutcomesTable outcomesTable = new OutcomesTable();
    failed(failedOutcomes, new UUIDExceptionWrapper(new OutcomesFailed(outcomesTable))).describeTo(reporter);
    skipped().describeTo(reporter);
    // Then
    verify(reporter).successful(successful);
    verify(reporter, times(2)).pending(pending);
    verify(reporter).notPerformed(notPerformed);
    verify(reporter).ignorable(ignorable);
    verify(reporter).comment(comment);
    verify(reporter).failed(failed, cause);
    verify(reporter).failedOutcomes(failedOutcomes, outcomesTable);
}
Also used : StoryReporter(org.jbehave.core.reporters.StoryReporter) OutcomesFailed(org.jbehave.core.model.OutcomesTable.OutcomesFailed) PendingStepFound(org.jbehave.core.failures.PendingStepFound) Matchers.containsString(org.hamcrest.Matchers.containsString) OutcomesTable(org.jbehave.core.model.OutcomesTable) UUIDExceptionWrapper(org.jbehave.core.failures.UUIDExceptionWrapper) Test(org.junit.Test)

Aggregations

Matchers.containsString (org.hamcrest.Matchers.containsString)1 PendingStepFound (org.jbehave.core.failures.PendingStepFound)1 UUIDExceptionWrapper (org.jbehave.core.failures.UUIDExceptionWrapper)1 OutcomesTable (org.jbehave.core.model.OutcomesTable)1 OutcomesFailed (org.jbehave.core.model.OutcomesTable.OutcomesFailed)1 StoryReporter (org.jbehave.core.reporters.StoryReporter)1 Test (org.junit.Test)1