Search in sources :

Example 26 with StubHookDefinition

use of io.cucumber.core.backend.StubHookDefinition in project cucumber-jvm by cucumber.

the class TeamCityPluginTest method should_print_location_hint_for_java_hooks.

@Test
void should_print_location_hint_for_java_hooks() {
    Feature feature = TestFeatureParser.parse("path/test.feature", "" + "Feature: feature name\n" + "  Scenario: scenario name\n" + "    Given first step\n");
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    Runtime.builder().withFeatureSupplier(new StubFeatureSupplier(feature)).withAdditionalPlugins(new TeamCityPlugin(new PrintStream(out))).withEventBus(new TimeServiceEventBus(fixed(EPOCH, of("UTC")), UUID::randomUUID)).withBackendSupplier(new StubBackendSupplier(singletonList(new StubHookDefinition("com.example.HookDefinition.beforeHook()")), singletonList(new StubStepDefinition("first step")), emptyList())).build().run();
    assertThat(out, bytesContainsString("" + "##teamcity[testStarted timestamp = '1970-01-01T12:00:00.000+0000' locationHint = 'java:test://com.example.HookDefinition/beforeHook' captureStandardOutput = 'true' name = 'Before']\n"));
}
Also used : TimeServiceEventBus(io.cucumber.core.runtime.TimeServiceEventBus) StubBackendSupplier(io.cucumber.core.runtime.StubBackendSupplier) StubFeatureSupplier(io.cucumber.core.runtime.StubFeatureSupplier) PrintStream(java.io.PrintStream) StubHookDefinition(io.cucumber.core.backend.StubHookDefinition) StubStepDefinition(io.cucumber.core.backend.StubStepDefinition) ByteArrayOutputStream(java.io.ByteArrayOutputStream) UUID(java.util.UUID) Feature(io.cucumber.core.gherkin.Feature) Test(org.junit.jupiter.api.Test)

Aggregations

StubHookDefinition (io.cucumber.core.backend.StubHookDefinition)26 StubStepDefinition (io.cucumber.core.backend.StubStepDefinition)26 Feature (io.cucumber.core.gherkin.Feature)26 StubBackendSupplier (io.cucumber.core.runtime.StubBackendSupplier)26 ByteArrayOutputStream (java.io.ByteArrayOutputStream)26 Test (org.junit.jupiter.api.Test)26 StubFeatureSupplier (io.cucumber.core.runtime.StubFeatureSupplier)25 TimeServiceEventBus (io.cucumber.core.runtime.TimeServiceEventBus)22 UUID (java.util.UUID)22 RuntimeOptionsBuilder (io.cucumber.core.options.RuntimeOptionsBuilder)8 StepDurationTimeService (io.cucumber.core.runner.StepDurationTimeService)7 TestFeatureParser (io.cucumber.core.feature.TestFeatureParser)6 Runtime (io.cucumber.core.runtime.Runtime)6 DataTable (io.cucumber.datatable.DataTable)6 PrintStream (java.io.PrintStream)6 Arrays.asList (java.util.Arrays.asList)6 Collections.emptyList (java.util.Collections.emptyList)6 Collections.singletonList (java.util.Collections.singletonList)6 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)6 DocString (io.cucumber.docstring.DocString)5