Skip to content

Incorrect recognition of steps between feature file and step definition #10

@dave00galloway

Description

@dave00galloway

in IDEA 2019.1.3 with kotlin for cucumber plugin 1.1.1 enabled, the recognition of step defs between feature files and step defs can be fooled into recognising an incorrect step defintion match.
For example after creating this scenario:

Scenario: another terrifying scenario
Given I have some preconditions
When I do something
Then something happens

and copy/pasting (and java to kotlin converting the steps) I have these step definitons which are recognised and click through-able from the feature to the step def.

Given("I have some preconditions") {
    // Write code here that turns the phrase above into concrete actions
    throw cucumber.api.PendingException()
}

When("I do something") {
    // Write code here that turns the phrase above into concrete actions
    throw cucumber.api.PendingException()
}

Then("something happens") {
    // Write code here that turns the phrase above into concrete actions
    throw cucumber.api.PendingException()
}

If I add another step :-

Scenario: another terrifying scenario
Given I have some preconditions
When I do something
And I do something with a "value" set as a parameter
Then something happens

then the new step is incorrectly matched in the IDE to

When("I do something") {
    // Write code here that turns the phrase above into concrete actions
    throw cucumber.api.PendingException()
}

This is potentially a problem as it could mean someone misses adding the implementation of a step because the IDE doesn't point out that its missing.

running the test does generate the correct snippet
When("I do something with a {string} set as a parameter", (String string) -> { // Write code here that turns the phrase above into concrete actions throw new cucumber.api.PendingException(); });
which is converted as:
When("I do something with a {string} set as a parameter") { string: String -> // Write code here that turns the phrase above into concrete actions throw cucumber.api.PendingException() }
Could the plugin be fixed to recognise the difference between similar steps e.g. where they begin with the same text ?

Navigating from the feature to the step def adds a further problem, as the IDE doesn't know which step def to pick. I would expect it to be able to choose the correct one without help from the user (see below)
Screen Shot 2019-06-03 at 11 08 57

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions