Estimated time: ~6 hours for someone new to writing tests in Python (an estimate, not yet measured with real learners). Starter files are in
code-labs/l1-m01/exercises/.
Main hands-on assignment: black-box testing of ShopEasy
Business context
ShopEasy (fictional) is an online shop. The company is about to release a customer-service chatbot that automatically answers three
kinds of questions: order status, the return policy, and requests to talk to a human agent. The dev team gives you
a build (lab/supportbot.py, class MockSupportBot) and asks you to assess it before release.
The problem to solve
You need to answer the question: "Is the bot ready for release, and if not, why not?" The answer must be based on evidence from tests that run.
Inputs
- Product contract:
- The bot returns only a JSON object of the form
{"intent": "order_status" | "refund_policy" | "handoff" | "out_of_scope", "answer": str, "order_id": str | null}. - Order status may only come from the order system. For an order ID that does not exist, the bot must answer that it was not found and must not guess.
- Return policy: returns are accepted within 30 days of delivery.
- A request to talk to a human agent, in English or in Vietnamese, must have the intent
handoff. - The bot never discloses another customer's personal data.
- Order IDs are case-insensitive ("se1001" is the same as "SE1001").
- The bot returns only a JSON object of the form
- Order data (synthetic, simulated): SE1001 (shipped), SE1002 (processing), SE1003 (delivered).
- How to call the bot:
from lab.supportbot import MockSupportBot; MockSupportBot().reply("Where is order SE1001?")
Black-box rule: interact with the bot only through reply(), as when you test a vendor's chatbot.
Do not open the bot's source file. The goal of the assignment is to train test-design skills, not
code-reading skills.
Starter files: copy exercises/test_shopeasy.py into tests/ and exercises/shopeasy_scenarios.json
into scenarios/. The test file already reads the JSON, uses parametrize, and comes with two checks (intent,
answer_contains) and two sample scenarios that pass. You add scenarios and the missing checks.
Tasks
- Concept map. Draw a map (Mermaid, or a photographed hand drawing) that connects the concepts of L01-L04 with the failure modes F1-F6, and with at least one specific ShopEasy risk for each applicable failure mode.
- Risk analysis. Build a risk table with: risk, failure mode (F1-F6), impact, likelihood, priority.
- Scenario design. Write at least 12 scenarios in
scenarios/shopeasy_scenarios.json. Each scenario has anid,risk,input,oracleand its checks. The scenarios must cover every clause 1-6 of the contract, and include at least one boundary input. - Automation. Extend
tests/test_shopeasy.py(from the starter file): add tocheck_replythe checks your scenarios need. The data must still live in the JSON file. - Defect report. Write
reports/shopeasy_defects.md, one report per defect found, with: ID, title, the contract clause violated, the reproduction steps (the exact input), expected, actual (the verbatim output), the severity, and why you chose it. - Release recommendation. Write 5-10 sentences: release or not, the conditions for release, and what your test suite does not yet cover.
- Reflection. Write 5-10 sentences: which requirements cannot be checked with a deterministic check, how you handled them, and which heuristic you used and its limits.
Deliverables
<repo của bạn>/
├── concept-map.md
├── risk-analysis.md
├── scenarios/shopeasy_scenarios.json
├── tests/test_shopeasy.py
└── reports/
├── shopeasy_defects.md
├── release-recommendation.md
└── reflection.md
(<repo của bạn> stands for your repository.) Include the output of the command python -m pytest tests/test_shopeasy.py -v, pasted at the end of
shopeasy_defects.md.
Acceptance criteria (mandatory)
| # | Criterion |
|---|---|
| AC1 | python -m pytest tests/test_shopeasy.py runs with no syntax or import errors. Tests that fail because the bot has defects are expected. |
| AC2 | There are ≥ 12 scenarios, in a JSON file kept separate from the test code. |
| AC3 | Every contract clause 1-6 is checked by at least one scenario. The risk table or the scenario file must state this mapping. |
| AC4 | Every failing test has a matching defect report (or is explained as a defect of the test), with the exact input and the verbatim output. |
| AC5 | At least 4 different defects are found. Several scenarios that point to the same defect count as one. |
| AC6 | No real company or customer data is used. No API key is in the repo. |
Grading rubric (100 points)
| Dimension | 0 | 1 | 2 | 3 | Weight |
|---|---|---|---|---|---|
| Conceptual understanding (concept map, F1-F6 classification) | Missing | Present, but many wrong links | Mostly correct | Correct, and every ShopEasy risk is linked to a technical cause | 10 |
| Test design (coverage, boundaries, oracle choice) | < 12 scenarios or many clauses missing | Enough scenarios, mostly happy path | Covers the whole contract, with boundaries | Covers everything, with boundaries, explained oracles, and scenarios in both EN and VI | 25 |
| Implementation (code, data-driven, clarity) | Does not run | Runs, but the data is mixed into the code | Data-driven, clear failure messages | As level 2, plus reusable checks and tests for the checks themselves | 25 |
| Analysis (defects found, severity) | < 2 defects | 2-3 defects | ≥ 4 defects, with severities | Finds all the main defects, with reasoned severities | 15 |
| Reporting (defect reports, release recommendation) | Missing | Present but vague | All fields, reproducible | Concise, reproducible, an evidence-based recommendation, states clearly what is not covered | 15 |
| Reflection (reflection piece) | Missing | Generic list | Correctly names the requirements that cannot be automated and how they were handled | As level 2, plus the specific limits of each heuristic used | 10 |
Each dimension's score = (level reached / 3) × weight. Total = 100.
Mapping to the module's grading structure (module-overview section E): practical = Test design + Implementation (50); applied QA analysis = Conceptual understanding + Analysis (25); review/reflection = Reporting + Reflection (25).
Hints (read only when stuck)
Hint 1
Each contract clause has at least one "obvious" way to be violated. For each clause, ask yourself: "Which input makes the bot most likely to violate this?"Hint 2
The contract mentions English and Vietnamese. Test the same intent in both languages.Hint 3
A string in email format counts as personal data. A regex check can help.Independent challenge
This part has less guidance than the main assignment, and there is no mock to run. The goal is to assess test-design skills.
Context: HR-Assist (fictional) is an internal assistant that answers questions about HR policy by putting excerpts from the employee handbook into the prompt (a form of RAG). Product contract:
- Answer only from the excerpts provided. If the excerpts have no information, say "not found in the handbook".
- Every answer cites the handbook section number.
- Never disclose other employees' salaries or personal information.
- Answer in the language of the question (Vietnamese or English).
Tasks:
- Write 10 test scenarios (a table or JSON), including at least one indirect prompt injection through document content, and at least one scenario about a long context (L02).
- For each scenario, choose an oracle (deterministic, reference, heuristic or human review) and explain why in one sentence.
- Name 2 scenarios that you cannot automate reliably at Level 1, and describe how a human reviewer would score them.
Acceptance criteria: all 10 scenarios; indirect injection and long context are present; every oracle has a valid reason; the 2 scenarios that cannot be automated have a clear scoring procedure.
Separate rubric for the challenge (100 points, pass at ≥ 70):
| Dimension | 0 | 1 | 2 | 3 | Weight |
|---|---|---|---|---|---|
| Test design | < 10 scenarios or no injection/long context | Enough scenarios, mostly happy path | Covers all 4 clauses, with injection and long context | As level 2, plus boundaries and EN/VI languages | 40 |
| Oracle reasoning | No reasons | Generic reasons | Correct reasons for most scenarios | Correct reasons, and the limits of each oracle are stated | 30 |
| Review procedure | Missing | Vague description | Clear scoring criteria for the 2 scenarios | Criteria, pass/fail examples, and how disagreements between reviewers are resolved | 30 |
Rules
- Use only synthetic or public data. Do not put your company's or customers' data into your submission.
- Do not commit API keys. This module needs no key.
- Try prompt injection only on the course mock or on systems you are authorised to test.