Search in sources :

Example 1 with PendingException

use of cucumber.api.PendingException in project cucumber-jvm by cucumber.

the class RuntimeTest method should_add_pending_result_to_the_summary_counter.

@Test
public void should_add_pending_result_to_the_summary_counter() throws Throwable {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    Reporter reporter = mock(Reporter.class);
    StepDefinitionMatch match = createExceptionThrowingMatch(new PendingException());
    Runtime runtime = createRuntimeWithMockedGlue(match, "--monochrome");
    runScenario(reporter, runtime, stepCount(1));
    runtime.printStats(new PrintStream(baos));
    assertThat(baos.toString(), containsString(String.format("" + "1 Scenarios (1 pending)%n" + "1 Steps (1 pending)%n")));
}
Also used : PrintStream(java.io.PrintStream) StepDefinitionReporter(cucumber.api.StepDefinitionReporter) Reporter(gherkin.formatter.Reporter) PendingException(cucumber.api.PendingException) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Test(org.junit.Test)

Example 2 with PendingException

use of cucumber.api.PendingException in project cucumber-jvm by cucumber.

the class RuntimeTest method non_strict_with_pending_steps.

@Test
public void non_strict_with_pending_steps() {
    Runtime runtime = createNonStrictRuntime();
    runtime.addError(new PendingException());
    assertEquals(0x0, runtime.exitStatus());
}
Also used : PendingException(cucumber.api.PendingException) Test(org.junit.Test)

Example 3 with PendingException

use of cucumber.api.PendingException in project alien4cloud by alien4cloud.

the class TopologyStepDefinitions method I_create_a_in_an_archive_name_version.

@Given("^I create a \"([^\"]*)\" \"([^\"]*)\" in an archive name \"([^\"]*)\" version \"([^\"]*)\"$")
public void I_create_a_in_an_archive_name_version(String componentType, String elementId, String archiveName, String archiveVersion) throws Throwable {
    AbstractInheritableToscaType element = new AbstractInheritableToscaType();
    element.setAbstract(false);
    element.setElementId(elementId);
    element.setArchiveName(archiveName);
    element.setArchiveVersion(archiveVersion);
    element.setWorkspace(AlienConstants.GLOBAL_WORKSPACE_ID);
    Class<?> clazz = null;
    if (componentType.equals("capability") || componentType.equals("capabilities")) {
        clazz = CapabilityType.class;
    } else {
        throw new PendingException("creation of Type " + componentType + "not supported!");
    }
    esClient.prepareIndex(ElasticSearchDAO.TOSCA_ELEMENT_INDEX, MappingBuilder.indexTypeFromClass(clazz)).setSource(JsonUtil.toString(element)).setRefresh(true).execute().actionGet();
}
Also used : PendingException(cucumber.api.PendingException) AbstractInheritableToscaType(org.alien4cloud.tosca.model.types.AbstractInheritableToscaType) Given(cucumber.api.java.en.Given)

Example 4 with PendingException

use of cucumber.api.PendingException in project cucumber-jvm by cucumber.

the class RuntimeTest method strict_with_pending_steps_and_no_errors.

@Test
public void strict_with_pending_steps_and_no_errors() {
    Runtime runtime = createStrictRuntime();
    runtime.addError(new PendingException());
    assertEquals(0x1, runtime.exitStatus());
}
Also used : PendingException(cucumber.api.PendingException) Test(org.junit.Test)

Example 5 with PendingException

use of cucumber.api.PendingException in project cucumber-jvm by cucumber.

the class JUnitReporterTest method after_with_pending_exception_non_strict.

@Test
public void after_with_pending_exception_non_strict() {
    createNonStrictReporter();
    createDefaultRunNotifier();
    Result result = mock(Result.class);
    Match match = mock(Match.class);
    when(result.getStatus()).thenReturn("Pending");
    when(result.getError()).thenReturn(new PendingException());
    EachTestNotifier executionUnitNotifier = mock(EachTestNotifier.class);
    jUnitReporter.executionUnitNotifier = executionUnitNotifier;
    jUnitReporter.after(match, result);
    jUnitReporter.finishExecutionUnit();
    verify(executionUnitNotifier).fireTestIgnored();
}
Also used : EachTestNotifier(org.junit.internal.runners.model.EachTestNotifier) PendingException(cucumber.api.PendingException) Result(gherkin.formatter.model.Result) Match(gherkin.formatter.model.Match) Test(org.junit.Test)

Aggregations

PendingException (cucumber.api.PendingException)10 Test (org.junit.Test)8 Result (gherkin.formatter.model.Result)5 EachTestNotifier (org.junit.internal.runners.model.EachTestNotifier)5 Match (gherkin.formatter.model.Match)3 StepDefinitionReporter (cucumber.api.StepDefinitionReporter)1 Given (cucumber.api.java.en.Given)1 Reporter (gherkin.formatter.Reporter)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 PrintStream (java.io.PrintStream)1 AbstractInheritableToscaType (org.alien4cloud.tosca.model.types.AbstractInheritableToscaType)1