Skip to content

Instantly share code, notes, and snippets.

@elialbert
Created December 10, 2015 16:05
Show Gist options
  • Save elialbert/b74bb941c66b9f084dbd to your computer and use it in GitHub Desktop.
Save elialbert/b74bb941c66b9f084dbd to your computer and use it in GitHub Desktop.
a test plan for the shopping cart level up exercise
Shopping Cart
You need some exercise in writing test plans. I've got the cure for what ails you. Write a test plan for a basic shopping cart. Make sure to include Happy Path, Sad Path and Bad Path in your tests.
It can be helpful to use something like the Cucumber syntax for this, but you don't need to write the entire implementation this time. You're welcome.
Requirements
The shopping cart behaves a lot like every other cart you've seen on the internet. We're not shooting for the stars on this one.
I should be able to add, remove, and change quantities on items in my cart.
I should be able to get back to item pages from the cart by clicking on individual cart item lines.
I should be able to put in my address information to get shipping estimates.
I should be able to add coupons, which are hopefully not expired.
Pay attention to cases such as logging in (if I have items in my cart as an anonymous user, but also have cart items from a previous authenticated session), or adding another item of the same SKU as others in my cart.
Don't worry about product pages or checkout.
Shopping Cart Test Plan
Attributes: Simple, Classic
Components: Cart Line Item, Shipping, Coupons, Login Handler
Capabilities (Features):
Cart Line Item:
Given there is a cart line item
When I click delete
Then it should go away
Given there is a cart line item
When I increase the quantity
Then it should update for the new quantity
And show the new price
Given there is no cart line item
When I click add from a product page
Then the cart should show a new line item
Given there is a cart line item
When I increase the quantity too high
Then I should be warned
Given there is a cart line item
When I increase the quantity below 0
Then I should be warned
Given there is a cart line item
When I click the item link
Then I should go to the item page
Given there is a cart line item
When I click an item link for a deleted item (sad path)
Then I should get a 404 page
Given there is a cart line item
When I add another item of the same sku
Then I should have 1 cart line item with quantity increased
And I should not have 2 copies of the same item in the cart
Shipping:
Given I have not input address information
When I click to check out
Then I should be asked for address information
Given I have not input address information
When I view the cart
Then there should not be a shipping estimate
Given I have not input address information
When I input address information
Then I should see a shipping estimate
Coupons:
Given I view the cart
When I have not input any coupons
Then there should not be any coupon discount
Given I view the cart
When I input a proper coupon
Then I should see the coupon discount applied correctly to the price
Given I view the cart
When I input a fake coupon
Then I should be notified of invalid coupon
And there should not be any coupon discount
Given I view the cart
When I input a coupon containing a SQL injection
Then the database should remain unpwned
Login Handler:
Given I am not logged in
When I add an item to cart
Then I should be able to view the item in my cart
Given I am not logged in
When I add an item to cart
And I log in
And I add another item to the cart
Then I should see both items in the cart
Given I am logged in
When I add an item to the cart
And I log out
Then I should not see the item in the cart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment