Testing foundations
A short description of a feature from the user's side: who, what, why.
- When to use it
- Before choosing what to test.
- In the lab
- Describe a shopper who wants to know whether a declined payment was saved as a paid order.
Shopper → wallet checkout → accurate order history
The rules a story must meet to count as done.
- When to use it
- When teammates need to agree what success looks like.
- In the lab
- Write one observable rule. After a decline, the matching order must show Declined.
Declined payment → saved order must say Declined
One check: steps, input and the expected result.
- When to use it
- When translating one rule into a repeatable check.
- In the lab
- Start with one wallet, decline the payment once, then inspect that order’s status.
Given one wallet → decline once → check the saved row
The list of test cases for a feature, ranked by risk.
- When to use it
- Before several checks compete for time.
- In the lab
- Rank the misleading Paid status first. Record the risk, the expected result and the evidence to collect.
STORY-2.md / Setup · Action · Expected · Evidence
A test case written as code, so a computer can run it.
- When to use it
- When a manual check needs to run again.
- In the lab
- Turn the decline steps into a Playwright spec and run it against both editions.
declined-wallet.spec.ts / Playwright executes the steps
A group of test scripts run together.
- When to use it
- When a change could affect several behaviors.
- In the lab
- Run checkout, cart and history checks together. Read each failure before judging the build.
tests/ → runner → results.json
The line in a test that checks a result and fails if it's wrong.
- When to use it
- When an action has finished and you need a verdict.
- In the lab
- Read the saved status and compare it with Declined. That comparison exposes the buggy edition.
Expected Declined / Received Paid
How a test finds an element on the page.
- When to use it
- When a script needs the right control or record.
- In the lab
- Find the order history table by its heading, then the row for this payment.
Order history → $19.99 row → Status cell
A first, simple test that shows the setup and style other tests copy.
- When to use it
- Before generating more tests for the same app.
- In the lab
- Run one small example from a fresh browser. Give the Engineer its setup and locator conventions.
tests/seed.ts → fresh cart → one decline
Something that used to work and now doesn't.
- When to use it
- After fixing an issue or changing related code.
- In the lab
- Keep the declined-order check and rerun it whenever checkout changes.
Fix the status → keep the test → run on the next change
A test that passes and fails on the same code.
- When to use it
- When repeated runs disagree with identical inputs.
- In the lab
- Repeat in isolated browser contexts and inspect the traces before changing any expectation.
Same revision + same input → inconsistent result
An input at or past a limit: zero, negative, the maximum.
- When to use it
- When a normal purchase already works.
- In the lab
- Try quantity zero, then minus one. Record whether the cart rejects each value.
Quantity 1 · 0 · −1
A bug that shows up when two actions happen at almost the same moment.
- When to use it
- When two actions could update the same balance.
- In the lab
- Use the bank’s simultaneous-transfer exercise. Compare both results with the posted ledger.
Two $80 transfers / starting balance $100
The version of the page that screen readers use: each control's role and name.
- When to use it
- When a control looks correct but a user may struggle to find it.
- In the lab
- Inspect the Pay control’s role and accessible name in each edition.
Role button / Accessible name Pay
A written record of a problem: steps, expected, actual, evidence.
- When to use it
- When someone else needs to reproduce the problem.
- In the lab
- Report the one payment attempt, the expected Declined status, the actual Paid row and the screenshot.
Steps → Expected Declined → Actual Paid
Proof of what happened: a trace, screenshot or video.
- When to use it
- When deciding whether a finding can be trusted.
- In the lab
- Save the decline and the order row from the same browser session. Link them to the run.
02-decline.png + 03-history.png + trace.zip
The call on whether a build is safe to ship.
- When to use it
- Before making a ship decision.
- In the lab
- Read the failing check, the user impact and the remaining risk. Give a reason for shipping or holding.
Failing check → customer impact → ship or hold
AI basics
A model trained on huge amounts of text that predicts and writes text.
- When to use it
- When a task requires interpreting a requirement or proposing a check.
- In the lab
- Give the model the story and browser evidence. Verify its proposed assertion against the saved row.
Story + observation → model → proposed next check
A model is one specific LLM; a provider is the company that serves it.
- When to use it
- When configuring how an agent gets model responses.
- In the lab
- Choose the model you intend to use and configure the matching provider in the server environment.
Provider account → configured model → response
A secret that lets your program use a provider's models, billed to you.
- When to use it
- When the local coordinator needs to authenticate.
- In the lab
- Load the key from the server environment. Display the run ID in the recording, keeping the credential private.
Server environment → provider authentication
You use your own API key instead of ours.
- When to use it
- When running the capstone in your own environment.
- In the lab
- Supply a key from your own provider account and check its usage after a small test run.
Student account → student key → capstone
The text you send the model.
- When to use it
- When asking the Analyst to investigate a particular story.
- In the lab
- Ask for one declined wallet attempt and a comparison of the checkout message with the saved row.
Check the saved order from one declined payment.
Standing instructions that shape every answer.
- When to use it
- When a role needs consistent responsibilities across stories.
- In the lab
- Put the Analyst’s evidence and handoff instructions in its role file.
ROLE.md + skill instructions → role guidance
Everything the model can see at once, with a size limit.
- When to use it
- When a model needs enough information to make a decision.
- In the lab
- Pass the approved criterion and relevant row. Keep unrelated logs out of that handoff.
Window / story · observation · approved plan
A unit of text processed by the model. Token counts depend on the model and the text.
- When to use it
- When deciding how much context and output a run can afford.
- In the lab
- Check the reported token usage against the role’s budget after a short run.
Input tokens + generated tokens → usage
The model asks your program to run a function, then uses the result.
- When to use it
- When the model needs an observation from outside its conversation.
- In the lab
- Let the Analyst request order history. Inspect the returned row before accepting its conclusion.
shop__read_order_history → $19.99 · Paid
Making the model answer in an exact shape, checked by code.
- When to use it
- When one agent’s answer feeds another program.
- In the lab
- Validate the result’s required fields before passing the plan path to the Engineer.
submit_result → schema validation → handoff
A confident answer that isn't true.
- When to use it
- When a model states a fact about the run.
- In the lab
- Ask which captured order supports the claim that payment succeeded. Compare that row with the checkout message.
Claim “Charged” / Evidence no ledger entry
The same prompt can produce different answers.
- When to use it
- When evaluating consistency across agent runs.
- In the lab
- Repeat the same story several times. Score the grounded result even if the wording varies.
Same story → run A, run B, run C → compare
Agents and agentic AI
Fixed steps decided in advance by a person. May call an AI, but the path never changes.
- When to use it
- When the steps and their order are known in advance.
- In the lab
- Configure a checkout test job to run on a push and publish its report.
Push → install → test → publish report
An LLM working toward a goal in a loop, choosing its own next step and using tools.
- When to use it
- When the next useful action depends on evidence.
- In the lab
- Give the Analyst the story and bounded tools. Observe which tool it chooses after the decline.
Requirement → choose tool → inspect result
Think, act with a tool, look at the result, repeat until done or out of budget.
- When to use it
- When following how an agent reaches a conclusion.
- In the lab
- Read one tool request, its returned evidence and the next decision. Stop at the plan gate.
Observe → choose → act → observe
In this course, a system of specialized agents that work toward a goal and hand off work under human oversight.
- When to use it
- When the work has distinct responsibilities and handoffs.
- In the lab
- Run the Analyst, review its plan, then let the Engineer generate the agreed check.
Analyst → human approval → Engineer
A function an agent may call: click, read a file, file a bug.
- When to use it
- When a role needs a concrete capability.
- In the lab
- Expose the order-history reader to the Analyst and inspect the data that it returns.
Tool name + arguments → observation
An open standard for connecting AI apps to tools and data. Servers offer tools, resources and prompts; AI apps connect to them as clients.
- When to use it
- When an AI application needs to discover and call tools from separate services.
- In the lab
- Connect the story and shop servers, then inspect the named tools the role can use.
Host ↔ MCP client ↔ MCP server
A program that exposes tools over MCP.
- When to use it
- When a bounded service needs to offer an operation to a role.
- In the lab
- Start the configured shop server and call its reader for the current workbook.
shop server / open_workbook · decline_wallet
The AI app that connects to MCP servers and lets the model use their tools.
- When to use it
- When distinguishing the application from the services it calls.
- In the lab
- Trace the coordinator’s connection from its client to the shop server and back.
Coordinator (host) → client connection → shop
Three agent definitions that ship with Playwright: planner (writes a plan), generator (writes tests), healer (fixes broken tests).
- When to use it
- When exploring Playwright’s own assisted planning and test maintenance.
- In the lab
- Compare its planner, generator and healer roles with the responsibilities of this course’s five agents.
Planner / Generator / Healer
A repository briefing for coding assistants, with project conventions, setup and test commands.
- When to use it
- When a coding assistant needs project-wide instructions.
- In the lab
- Put shared build commands and repository conventions in the project briefing.
Repo root / AGENTS.md / project conventions
The course file that defines one crew member’s purpose, instructions, tools and responsibilities.
- When to use it
- When defining one member of this crew.
- In the lab
- Open agents/quality-analyst/ROLE.md. Read the role’s purpose, allowed method and handoff before changing it.
agents/quality-analyst/ROLE.md
A folder with a SKILL.md file teaching an agent one repeatable task, following the open Agent Skills format.
- When to use it
- When the same activity needs a repeatable method.
- In the lab
- Give the Analyst a plan-writing skill with a checklist for expected and observed behavior.
skills/plan-writing/SKILL.md
Limits used to constrain agent actions, such as allowed tools, hosts, budgets and write locations.
- When to use it
- When an agent can use external systems or write files.
- In the lab
- Limit the shop host and output paths, then check the role’s permitted tools before running it.
Allowed host + write scope + tool list
A pause where a person must approve before the work continues.
- When to use it
- When a proposed action needs human judgment.
- In the lab
- Compare the plan with the $19.99 evidence. Approve the specific saved-order assertion.
Plan ready → review evidence → approve
Caps on steps, tokens and minutes per agent.
- When to use it
- Before starting a run with paid calls or several steps.
- In the lab
- Set limits in the role configuration. Check usage and the stop reason when the run ends.
maxSteps / maxTokens / maxMinutes
The exact shape of an agent's input and output, checked by code.
- When to use it
- When one role hands data to another.
- In the lab
- Validate that the plan identifies the story, its evidence and the next role’s required inputs.
Plan path + required fields → validate
One agent's output becomes the next agent's input.
- When to use it
- When a second role depends on reviewed work.
- In the lab
- Pass the plan path and approval under the same run ID. Have the Engineer read that file.
Run ID → approved plan → next role
Decides the order, passes the baton and pauses at gates. You are the orchestrator; the coordinator is the code that carries it out.
- When to use it
- When deciding which role owns the next action.
- In the lab
- Start the chain once. Watch the coordinator pause after the Analyst and resume after approval.
Start chain → pause at gate → resume
The system where work and results officially live.
- When to use it
- When several systems show different versions of an event.
- In the lab
- Use the acceptance rule to decide what should happen. Use the stored order to establish what actually happened.
Story defines expected / record shows actual
Repeatable tests for the agents themselves, scored against known answers.
- When to use it
- When role instructions, tools or models change.
- In the lab
- Run the same labeled stories and compare the crew’s findings with the expected findings.
Known story → agent run → grade against rubric
Text in a page or ticket that tries to give the agent new instructions.
- When to use it
- When a page, ticket or tool response contains instructions addressed to an agent.
- In the lab
- Treat that text as evidence. Keep using the tools and limits from the trusted role configuration.
Untrusted page text → evidence only