Closed vikramvi closed 8 years ago
it seems that some scenario is used as When and as Given but quite bad practice
In Cucumber, the @Given, @When and @Than tags are interchangeable, and it is common to use regexes to match a statement either in the past tense (for a given - 'given I have purchased a book for $10') or the present ('when I purchase a book for $10'). The underlying interaction is the same in both cases. You can use whatever form reads best - in BDD, the most important is to capture the conversation to build a shared understanding, and you should never let a templated format get in the way of building a shared understanding.
Sent from my iPhone
On 13 Feb 2016, at 01:31, Vikram Ingleshwar notifications@github.com wrote:
Hi, In add_item_to_shopping_cart.feature "I have selected item 1" is tagged as "Given".
But under DisplayProductDetailsScenarioSteps.java it's marked as "When"
@When("I (?:have selected|select) item (\d+)") public void whenISelectListingItem(int number) { ListingItem selectedListingItem = buyer.selects_listing(number); Serenity.setSessionVariable(SELECTED_LISTING).to(selectedListingItem); }
Please clarify
Thanks, Vikram
— Reply to this email directly or view it on GitHub.
Hi, In add_item_to_shopping_cart.feature "I have selected item 1" is tagged as "Given".
But under DisplayProductDetailsScenarioSteps.java it's marked as "When"
@When("I (?:have selected|select) item (\d+)") public void whenISelectListingItem(int number) { ListingItem selectedListingItem = buyer.selects_listing(number); Serenity.setSessionVariable(SELECTED_LISTING).to(selectedListingItem); }
Please clarify
Thanks, Vikram