Search in sources :

Example 11 with Pickle

use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.

the class TagPredicateTest method not_tag_predicate_matches_pickle_with_no_tags.

@Test
void not_tag_predicate_matches_pickle_with_no_tags() {
    Pickle pickle = createPickleWithTags();
    TagPredicate predicate = createPredicate("not @FOO");
    assertTrue(predicate.test(pickle));
}
Also used : Pickle(io.cucumber.core.gherkin.Pickle) Test(org.junit.jupiter.api.Test)

Example 12 with Pickle

use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.

the class PickleOrderTest method reverse_lexical_uri_order.

@Test
void reverse_lexical_uri_order() {
    when(firstPickle.getUri()).thenReturn(URI.create("file:com/example/a.feature"));
    when(firstPickle.getLocation()).thenReturn(new Location(2, -1));
    when(secondPickle.getUri()).thenReturn(URI.create("file:com/example/a.feature"));
    when(secondPickle.getLocation()).thenReturn(new Location(3, -1));
    when(thirdPickle.getUri()).thenReturn(URI.create("file:com/example/b.feature"));
    PickleOrder order = StandardPickleOrders.reverseLexicalUriOrder();
    List<Pickle> pickles = order.orderPickles(Arrays.asList(secondPickle, thirdPickle, firstPickle));
    assertThat(pickles, contains(thirdPickle, secondPickle, firstPickle));
}
Also used : Pickle(io.cucumber.core.gherkin.Pickle) Location(io.cucumber.plugin.event.Location) Test(org.junit.jupiter.api.Test)

Example 13 with Pickle

use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.

the class PickleOrderTest method lexical_uri_order.

@Test
void lexical_uri_order() {
    when(firstPickle.getUri()).thenReturn(URI.create("file:com/example/a.feature"));
    when(firstPickle.getLocation()).thenReturn(new Location(2, -1));
    when(secondPickle.getUri()).thenReturn(URI.create("file:com/example/a.feature"));
    when(secondPickle.getLocation()).thenReturn(new Location(3, -1));
    when(thirdPickle.getUri()).thenReturn(URI.create("file:com/example/b.feature"));
    PickleOrder order = StandardPickleOrders.lexicalUriOrder();
    List<Pickle> pickles = order.orderPickles(Arrays.asList(thirdPickle, secondPickle, firstPickle));
    assertThat(pickles, contains(firstPickle, secondPickle, thirdPickle));
}
Also used : Pickle(io.cucumber.core.gherkin.Pickle) Location(io.cucumber.plugin.event.Location) Test(org.junit.jupiter.api.Test)

Example 14 with Pickle

use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.

the class PickleRunnerWithStepDescriptionsTest method shouldUseStepKeyworkAndNameForChildName.

@Test
void shouldUseStepKeyworkAndNameForChildName() {
    List<Pickle> pickles = picklesFromFeature("featurePath", "" + "Feature: feature name\n" + "  Scenario: scenario name\n" + "    Then it works\n");
    PickleRunner runner = PickleRunners.withStepDescriptions(context, pickles.get(0), null, createJunitOptions());
    assertEquals("it works", runner.getDescription().getChildren().get(0).getMethodName());
}
Also used : PickleRunner(io.cucumber.junit.PickleRunners.PickleRunner) Pickle(io.cucumber.core.gherkin.Pickle) Test(org.junit.jupiter.api.Test)

Example 15 with Pickle

use of io.cucumber.core.gherkin.Pickle in project cucumber-jvm by cucumber.

the class PickleRunnerWithStepDescriptionsTest method shouldConvertTextFromFeatureFileForNamesWithFilenameCompatibleNameOption.

@Test
void shouldConvertTextFromFeatureFileForNamesWithFilenameCompatibleNameOption() {
    List<Pickle> pickles = picklesFromFeature("featurePath", "" + "Feature: feature name\n" + "  Scenario: scenario name\n" + "    Then it works\n");
    PickleRunner runner = PickleRunners.withStepDescriptions(context, pickles.get(0), null, createFileNameCompatibleJunitOptions());
    assertEquals("scenario_name", runner.getDescription().getDisplayName());
    assertEquals("scenario_name", runner.getDescription().getChildren().get(0).getClassName());
    assertEquals("it_works", runner.getDescription().getChildren().get(0).getMethodName());
}
Also used : PickleRunner(io.cucumber.junit.PickleRunners.PickleRunner) Pickle(io.cucumber.core.gherkin.Pickle) Test(org.junit.jupiter.api.Test)

Aggregations

Pickle (io.cucumber.core.gherkin.Pickle)39 Test (org.junit.jupiter.api.Test)37 PickleRunner (io.cucumber.junit.PickleRunners.PickleRunner)6 Collections.singletonList (java.util.Collections.singletonList)6 List (java.util.List)6 Glue (io.cucumber.core.backend.Glue)5 Collections.emptyList (java.util.Collections.emptyList)5 Feature (io.cucumber.core.gherkin.Feature)4 URI (java.net.URI)4 HookDefinition (io.cucumber.core.backend.HookDefinition)3 StaticHookDefinition (io.cucumber.core.backend.StaticHookDefinition)3 Step (io.cucumber.core.gherkin.Step)3 InOrder (org.mockito.InOrder)3 Location (io.cucumber.plugin.event.Location)2 DataTableArgument (io.cucumber.core.gherkin.DataTableArgument)1 FeatureParser (io.cucumber.core.gherkin.FeatureParser)1 FeatureParserException (io.cucumber.core.gherkin.FeatureParserException)1 RuntimeOptions (io.cucumber.core.options.RuntimeOptions)1 RuntimeOptionsBuilder (io.cucumber.core.options.RuntimeOptionsBuilder)1 Gherkin (io.cucumber.gherkin.Gherkin)1