Course map
Stage 1: Foundations
Stage 2: Data Integration
Stage 3: Building & Shipping
Stage 4: Customer Engagement
Stage 5: Specialization

Part 14 / Topic 4 of 6

Demo scripts and smoke tests

A demo script is the sequence of what you will say and do, step by step. And because environments rot between rehearsal and meeting, the script gets a smoke test — code that performs every step and checks the expected result, run minutes before you present:

# examples/02_a_pre_demo_smoke_test_check.py
from fastapi import FastAPI
from fastapi.testclient import TestClient

app = FastAPI()
DATA = {"S-2001": "delivered", "S-2004": "delayed"}
@app.get("/shipments/{sid}")
def get(sid: str):
    return {"id": sid, "status": DATA.get(sid, "unknown")}
@app.get("/summary")
def summary():
    return {"delayed": sum(v == "delayed" for v in DATA.values())}

DEMO_STEPS = [  # (what you will say, request, check)
    ("Look up a delivered shipment", "/shipments/S-2001", lambda j: j["status"] == "delivered"),
    ("Show a delayed one",           "/shipments/S-2004", lambda j: j["status"] == "delayed"),
    ("Daily summary shows 1 delay",  "/summary",          lambda j: j["delayed"] == 1),
]
client = TestClient(app)
ok = True
for say, path, check in DEMO_STEPS:
    r = client.get(path)
    passed = r.status_code == 200 and check(r.json())
    ok &= passed
    print(f"[{'PASS' if passed else 'FAIL'}] {say}")
print("ready to demo" if ok else "DO NOT DEMO: fix failures first")
# [PASS] Look up a delivered shipment
# [PASS] Show a delayed one
# [PASS] Daily summary shows 1 delay
# ready to demo

Note the structure: each step pairs the sentence you will say with the check that makes it true. The smoke test is the demo script, executable — and "DO NOT DEMO" twenty minutes early is a gift, not a failure.

🧪 Quick quiz

  1. What is a pre-demo smoke test?
Show the answer

A script that runs every step of the demo and checks the expected result before the meeting. All three steps passed, so the script printed "ready to demo". (verified against the example output above)

Done here? The practice set for Part 14 — 4 exercises with solutions — is on the part page.

Search the guide