Example Shooping Cart
Example Shooping Cart
Actor(s) Customer
1. User navigates to a product page.2. User selects product options (e.g., size, color).3.
Main Flow
User clicks "Add to Cart".
Postcondition The item is added to the cart, and the cart count updates.
Alternative 1a. If product options are not selected, prompt the user to choose options.2a. If the
Flows item is out of stock, display an error message.
Actor(s) Customer
1. User clicks on the cart icon.2. The system displays the cart with a list of added items,
Main Flow
quantities, and prices.3. User can review the total price and edit quantities.
Postcondition The user sees all items in the cart and can proceed to checkout.
Alternative
1a. If the cart is empty, display a message like "Your cart is empty".
Flows
Actor(s) Customer
1. User clicks the "Edit" button for an item in the cart.2. User modifies quantity or
Main Flow
options.3. User confirms the changes.4. The system updates the cart.
Alternative
1a. If the requested quantity exceeds stock, display a warning message.
Flows
Actor(s) Customer
1. User clicks the "Remove" button.2. The system removes the item from the cart.3.
Main Flow
The cart updates with a new total price.
Alternative
1a. If the cart is empty after removal, display an "Empty Cart" message.
Flows
Actor(s) Customer
Precondition The user has items in the cart and a valid discount code.
1. User enters a discount code.2. User clicks "Apply".3. The system validates the code
Main Flow
and recalculates the total price.
Alternative
1a. If the code is invalid, display an error message like "Invalid code".
Flows
Actor(s) Customer
1. User clicks "Checkout".2. System redirects to the checkout page.3. User reviews
Main Flow
order details, enters shipping and payment info.4. User confirms the order.
Postcondition The order is placed, and the user receives a confirmation message.
Alternative
1a. If payment fails, display an error and allow the user to retry.
Flows
Actor(s) Customer
1. User clicks "Save for Later".2. System saves the cart and displays a success
Main Flow
message.
Alternative Flows 1a. If the user is not logged in, prompt them to log in.
Here’s a detailed test case for the Add Item to Cart functionality, presented in a table format:
Test Case
Add Item to Cart
Name
Objective Verify that items can be successfully added to the shopping cart.
Precondition The user is on the product page, and the item is in stock.
1. Navigate to the product page.2. Select product options (if any).3. Click on the "Add to
Test Steps
Cart" button.4. Check the cart icon or cart page.
Expected The item is added to the cart.The cart count is updated.The item is listed on the cart
Result page with the correct details (e.g., name, price, options).
Test Data - Product name: "Sample Product"- Size: "Medium"- Color: "Red"- Quantity: 1
Priority High
Severity Critical
Pass Criteria The item is added to the cart successfully, with the correct details displayed.
- The item is not added to the cart.- Incorrect details are displayed.- Cart count does not
Fail Criteria
update.
Add item without selecting System displays an error message like "Please select all
TC01A
required options options".
TC01B Add item that is out of stock System displays an error message like "Item out of stock".
Add multiple items of the same The cart updates the quantity or adds multiple instances as
TC01D
product per implementation.