I am scripting the test on todo app.
the expected should be first scenarios has "First todo item #1"
then second scenario added "Next todo item"
in total 2 items only.
but actual result i got 3 items.
is that the way i written scenario wrong?
Scenario: Add first item
Given my todo list is empty
When I add "First todo item #1"
Then my todo list should contain:
| First todo item #1|
And the remaining item count should show "1 item left"
Scenario: Add another item
Given I have a todo list containing
| First todo item #1 |
When I add "Next todo item"
Then my todo list should contain:
| Next todo item |
| First todo item #1 |
And the remaining item count should show "2 items left"
Each scenario should be independent. Why don't you join your scenarios? You can add background section which is executed before each scenario:
Background:
Given my todo list is empty
Scenario: Item addition
When I add "First todo item #1"
Then my todo list should contain:
| First todo item #1|
And the remaining item count should show "1 item left"
When I add "Next todo item"
Then my todo list should contain:
| Next todo item |
| First todo item #1 |
And the remaining item count should show "2 items left"
Scenario: Item edition
...