Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

A step defined as Given, appear unidentified for When

These are two scenarios. One of the statement is used in both the scenarios but in second scenario it appear not defined, unless I use it same annotation with which it was used initially.

Scenario1:
Given I have items in cart <<
Then I can see total amount 

Scenario2:
Given I am valid user
And I go to an item
When I click on add to cart
Then I have items in cart << Step is not defined

enter image description here

Scenario2:
Given I am valid user
And I go to an item
When I click on add to cart
Given I have items in cart << Step is found when used with Given

How can I fix this?

Reference post: Specflow calling steps within steps causes "No matching step definition" error

However my question is about JBehave not Specflow. I am using JBehave, Java, Windows 7

Comments