Skip to content

Instantly share code, notes, and snippets.

@tourdedave
Last active August 29, 2015 14:02
Show Gist options
  • Save tourdedave/28a53f7519e82f8bf9d5 to your computer and use it in GitHub Desktop.
Save tourdedave/28a53f7519e82f8bf9d5 to your computer and use it in GitHub Desktop.
Feature: The shopping cart should be able to accept products chosen by user.
# This would be better written from the users's perspective since that is what the scenarios entail
# e.g., Feature: Users can add products to their shopping cart
Scenario: Anonymous user adds product to the cart
Given I am on a product page
When I click on Add To Cart button
And I click on the Add to Cart button in the product description modal
Then I should see "$68.99" in the grand total section
And I should see "You have 1 item ($68.99) in your shopping cart." in the cart summary
# Scenario Issue 1.
# You talk of an anonymous user in the scenario, but refer to the user as 'I' in the steps.
# In order to make this more clear, and to make it simpler to automate in the step definitions...
# I would change I to something more articulate.
# Scenario Issue 2.
# You're describing UI implementation details in your steps (e.g., button, modal, etc.)
# These could change and they don't really communicate intent
# I've seen teams prefer to keep this level of detail; typically for use with manual testing
# Here's a rewrite of the scenario to show you what I mean:
Scenario: Anonymous user adds product to their cart
Given an anonymous user is on a product page
# or Given an anonymous user is on product page X
When they add the item to their cart
Then will see "$68.99" in the grand total section
And they will see a cart summary with "You have 1 item ($68.99) in your shopping cart."
# Scenario Issue 3.
# This can also open up a can of questions related to number of products (and other concerns)...
# 1 product? 2 products? many products? -- although, this train of thought is a slipper slope...
# http://infiniteundo.com/post/80219871418/shopping-cart-explosion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment