Candidate steps should be aware of the method annotation type when matching textual steps

Description

Candidate steps should be aware of annotations @Given, @When and @Then and distinguish pattern steps arising from different annotations.
At present, there is no such distinction and can lead to very confusing behaviour.
Example:
@Given("foo named $name")
public void givenFoo(String name) {...}
@When("foo named $name is created")
public void createFoo{...}

If I have a scenario like this:
Scenario: Do stuff
Given xyz
When foo named Bar is created
...
then the "When" can match the givenFoo() method, which gets passed "Bar is created" as parameter.

This unexpected behaviour, due to the implict uniqueness required of the matching pattern across all annotations, causes randomness in test execution. Sometimes it works, sometimes it doesn't. It would be better if the different annotations where treated differently in the matching of patterns, so that when I write Given/When/Then in the scenarios they will match corresponding @Given/@When/@Then methods.

Activity

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created October 23, 2009 at 1:15 AM
Updated May 22, 2015 at 8:31 AM
Resolved October 30, 2009 at 9:00 AM