-
-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'And' step keyword add to more constraint #144
Comments
I also find this somewhat unintuitive.
Having
In the above, From the cucumber documentation, I would expect |
I don't follow what's not working. Please provide the Gherkin and C# code both. |
@ttutisani It's not that it's not working. It is functioning exactly according to the documentation for this project and there is a simple workaround so it's only a minor issue. To be fair, the cucumber documentation is also rather ambiguous about how it should function. I'm not sure how other projects handle this.
Source: https://cucumber.io/docs/gherkin/reference/ I would read this as the With the current implementation, there can be conflicting The Gherkin text from my example could be written as:
Which would result in C# code something like: [Given("no items are on the queue")]
public void GivenNoItemsAreOnTheQueue()
{
queue.Clear();
Assert.Empty(queue.Items);
}
[Then("no items are on the queue")]
public void ThenNoItemsAreOnTheQueue()
{
Assert.Empty(queue.Items);
} But if you introduce
[Given("no items are on the queue")]
[And("no items are on the queue")]
public void GivenNoItemsAreOnTheQueue()
{
queue.Clear();
Assert.Empty(queue.Items);
}
[Then("no items are on the queue")]
[And("no items are on the queue")]
public void ThenNoItemsAreOnTheQueue()
{
Assert.Empty(queue.Items);
} There are now two The workaround at the moment would be to avoid using
|
Understood, thanks for clarifying! I agree that it would be better if the And is treated as the last-found given/when/then, that would make it more intuitive. To be clear, Gherkin is not strict on such rules at all, and the framework's current state reflects that. |
The following feature tests does not works as expected:
The issue is with the step
And its not wild carded
if I decorated it with 'Given' attribute the test runner will not recognized it as is. I should be able to define all my 'Given/And' steps with the 'Given' attribute in my C# code. I'm using pytest-bdd for other projects and the 'And' step does not exists as is. You can define any 'Given' step you want and the two below scenario will work as expected.EDIT: Just adding that step 'representation string should be 'localhost'' related C# method need to be decorated with 'Then' and 'And' attribute, I should be able to decorate that method once with 'Then' attribute.
Do I missing something with this library ?
The text was updated successfully, but these errors were encountered: