← Back to Module 1

Guided Project: Lunch Ordering Service

Project Overview

In this guided project, you'll develop functional requirements and test cases for a Lunch Ordering Service application. This service allows employees to order lunch from partner restaurants for delivery to their workplace. You'll practice writing clear, testable requirements and comprehensive test cases to verify the application's behavior.

Business Context

A tech company wants to streamline lunch ordering for its employees. They're partnering with local restaurants to offer a variety of food options delivered to the office. The application needs to handle ordering, payment processing, delivery scheduling, and special dietary requirements.

Functional Requirements

Lunch Ordering Service Core Requirements

The application must allow users to:

  • Browse menus from multiple partner restaurants
  • Filter food options based on dietary restrictions (vegetarian, gluten-free, etc.)
  • Place lunch orders with customizations
  • Schedule deliveries for specific dates and time slots
  • Process payments through multiple methods (credit card, company account)
  • Track order status in real-time
  • Cancel orders (with restrictions based on time to delivery)
  • Leave reviews for restaurants and specific menu items

Use Cases

UC001: Place Lunch Order

Primary Actor: Employee

Preconditions:

  • User is authenticated and logged into the application
  • At least one restaurant is available for ordering
  • Current time is within the ordering window (before 10:30 AM for same-day delivery)

Steps:

  1. User selects "Place New Order" from the dashboard
  2. System displays a list of available restaurants
  3. User selects a restaurant
  4. System displays menu items with prices and dietary information
  5. User selects one or more menu items
  6. User customizes items if needed (e.g., "no onions")
  7. User selects delivery date and time slot
  8. User selects payment method
  9. User confirms the order
  10. System processes payment
  11. System confirms the order and provides order tracking number

Postconditions:

  • Order is created in the system with status "Confirmed"
  • Payment is processed successfully
  • Restaurant is notified of the new order
  • User receives order confirmation via email
  • Order appears in user's order history

Alternative Flows:

  • Payment fails: System notifies user and allows them to try a different payment method
  • Time slot unavailable: System suggests alternative time slots

UC002: Filter Menu by Dietary Restrictions

Primary Actor: Employee

Preconditions:

  • User is viewing a restaurant's menu
  • Menu items have dietary information available

Steps:

  1. User selects "Filter Options" button
  2. System displays available dietary filters (vegetarian, vegan, gluten-free, nut-free, etc.)
  3. User selects one or more dietary filters
  4. User applies filters
  5. System displays only the menu items that match the selected dietary restrictions

Postconditions:

  • Only menu items matching the dietary restrictions are visible
  • Filter selections remain active until cleared by the user

UC003: Cancel an Order

Primary Actor: Employee

Preconditions:

  • User has at least one active order
  • The order's scheduled delivery time is more than 1 hour in the future

Steps:

  1. User navigates to "My Orders" section
  2. User selects the order to cancel
  3. User clicks "Cancel Order" button
  4. System requests confirmation
  5. User confirms cancellation
  6. System processes cancellation and initiates refund if applicable

Postconditions:

  • Order status is updated to "Cancelled"
  • Restaurant is notified of the cancellation
  • User receives cancellation confirmation
  • Payment is refunded to the user (if within refund policy timeframe)

Alternative Flows:

  • Order is within 1 hour of delivery: System prevents cancellation and displays message about cancellation policy

Test Cases

TC001: Successful Order Placement

Test Case ID: TC001

Description: Verify that a user can successfully place a lunch order

Related Use Case: UC001

Preconditions:

  • User is logged in
  • Current time is 9:00 AM (within ordering window)
  • "Pasta Palace" restaurant is available
  • User has a valid credit card on file

Test Steps:

  1. Click "Place New Order" button on dashboard
  2. Select "Pasta Palace" from restaurant list
  3. Select "Spaghetti Carbonara" from menu
  4. Add customization: "Extra cheese"
  5. Select today's date and 12:30 PM delivery slot
  6. Select "Saved Credit Card" as payment method
  7. Click "Confirm Order" button

Expected Results:

  • Order confirmation screen is displayed
  • Order tracking number is provided
  • Order status shows "Confirmed"
  • Confirmation email is sent to user's email address
  • Order appears in "My Orders" section with correct details
  • Credit card is charged the correct amount ($12.99 + tax)

TC002: Menu Filtering by Dietary Restriction

Test Case ID: TC002

Description: Verify that menu items can be filtered by dietary restrictions

Related Use Case: UC002

Preconditions:

  • User is logged in
  • User is viewing "Global Cuisine" restaurant menu
  • Menu contains items with various dietary properties

Test Steps:

  1. Note the total number of menu items displayed
  2. Click "Filter Options" button
  3. Select "Vegetarian" checkbox
  4. Select "Gluten-Free" checkbox
  5. Click "Apply Filters" button

Expected Results:

  • Only menu items that are both vegetarian and gluten-free are displayed
  • Filter indicators are shown at the top of the menu
  • Each displayed item shows both the "Vegetarian" and "Gluten-Free" icons
  • Number of items displayed is less than the initial count

TC003: Order Cancellation Within Policy Timeframe

Test Case ID: TC003

Description: Verify that orders can be cancelled when more than 1 hour before delivery

Related Use Case: UC003

Preconditions:

  • User is logged in
  • User has an active order with status "Confirmed"
  • Order is scheduled for delivery at 1:00 PM
  • Current time is 11:30 AM (90 minutes before delivery)

Test Steps:

  1. Navigate to "My Orders" section
  2. Select the order for 1:00 PM delivery
  3. Click "Cancel Order" button
  4. Confirm cancellation in the dialogue

Expected Results:

  • Cancellation confirmation message is displayed
  • Order status is updated to "Cancelled"
  • Refund information is displayed
  • Cancellation confirmation email is sent

TC004: Order Cancellation Outside Policy Timeframe

Test Case ID: TC004

Description: Verify that orders cannot be cancelled when less than 1 hour before delivery

Related Use Case: UC003

Preconditions:

  • User is logged in
  • User has an active order with status "Confirmed"
  • Order is scheduled for delivery at 1:00 PM
  • Current time is 12:15 PM (45 minutes before delivery)

Test Steps:

  1. Navigate to "My Orders" section
  2. Select the order for 1:00 PM delivery
  3. Attempt to click "Cancel Order" button (if available)

Expected Results:

  • "Cancel Order" button is disabled or not shown
  • Message is displayed explaining cancellation policy
  • Order status remains "Confirmed"
  • No refund is processed

Implementation Plan

Project Phases

  1. Requirements Gathering and Analysis
    • Interview stakeholders to understand business needs
    • Document functional and non-functional requirements
    • Prioritize features for implementation
    • Create user personas and scenarios
  2. Design and Architecture
    • Design database schema for order management
    • Create API specifications for restaurant integration
    • Design user interface wireframes
    • Define system architecture and components
  3. Implementation
    • Set up development environment
    • Implement restaurant menu browsing functionality
    • Develop order placement and tracking features
    • Integrate payment processing system
    • Implement notification services
  4. Testing
    • Develop comprehensive test plan
    • Write unit tests for core functionality
    • Perform integration testing with restaurant APIs
    • Conduct user acceptance testing
    • Identify and fix bugs and issues
  5. Deployment and Maintenance
    • Deploy application to production environment
    • Monitor system performance and user feedback
    • Implement enhancements based on user input
    • Scale system as user base grows

Sample Java Implementation for Order Processing

public class LunchOrder {
    private String orderId;
    private User customer;
    private Restaurant restaurant;
    private List<MenuItem> items;
    private LocalDateTime deliveryTime;
    private OrderStatus status;
    private PaymentMethod paymentMethod;
    private double totalAmount;
    
    // Constructor, getters, setters
    
    public boolean isEligibleForCancellation() {
        LocalDateTime now = LocalDateTime.now();
        return now.plusHours(1).isBefore(deliveryTime);
    }
    
    public void cancel() throws OrderException {
        if (!isEligibleForCancellation()) {
            throw new OrderException("Orders can only be cancelled at least 1 hour before delivery");
        }
        
        this.status = OrderStatus.CANCELLED;
        // Process refund logic
    }
    
    public void addCustomization(MenuItem item, String customization) {
        // Add customization to menu item
    }
    
    // Other methods for order processing
}
                

Video Content

Resources