← Back to Guided Projects

Module 1 Guided Project

Writing and Testing Functional Requirements

In this guided project, you'll learn how to write effective functional requirements and create tests to verify them. You'll practice creating use cases with clear preconditions, steps, and postconditions.

Lunch Ordering Service Overview

BloomTech has decided that lunch is a new benefit of the Backend Development program, with the one condition that we build a service to manage the orders.

The instructor team has been busy building the first part of the service. There is an API (just a fancy way of saying a set of methods) to create a new lunch order, and to retrieve a lunch order once it has been created. The lunch orders will be persisted in a database and we will retrieve all RECEIVED orders at 11:30 am each day and execute the orders so lunch will arrive around noon.

Creating an Order

To create an order a user must send a create request to the order API with the following information: who is ordering the lunch, the id of the restaurant to order from, and the menu item to order. Below is an example of request data necessary to create a lunch order from Ba Bar.

{
  "customerName": "Ada",
  "restaurantId": "21a70111-52ba-4c81-b4d8-ded39f48808f",
  "menuItem": "Coconut Curry with Chicken"
}
                

Using Use Cases for Testing

For any software system, we need to identify:

  • The preconditions that must be true before we can use the system
  • The invariants that shouldn't change during the use of the system
  • The postconditions that should be true after we use the system
  • The steps that a user would take while using the system

In our Lunch Ordering Service, we'll need to formally document the use cases for both creating a new order and retrieving an existing order, and then execute tests to verify the system behaves according to our use cases.

Project Steps

  1. Understand the requirements of the system

    Explore the API documentation and understand what functionality is expected from the lunch ordering service.

  2. Identify the key users and actors

    Determine who will interact with the system (customers, restaurant, system administrators, etc.).

  3. Brainstorm use cases

    Create a list of potential use cases for both creating an order and retrieving an order. Consider both happy paths and alternative paths.

  4. Formalize the use cases

    For each use case, document:

    • A clear name/description
    • Preconditions
    • Invariants
    • Postconditions
    • Steps
  5. Execute the use cases

    Manually test each use case to verify the system behaves as expected. Document any issues found.

  6. Create bug reports

    For any issues found, create detailed bug reports that include steps to reproduce, expected vs. actual behavior, and any relevant context.