Module: L1-M04 · Duration: ~165 min (estimate, including one 30 min session) · Previous: L02 · Next: L04 - Prompt injection for testers (direct and indirect)
1. Introduction
Scripted tests only check what you have already thought of. For an LLM feature, the input space is practically infinite, and many important defects only show up when a person tries something, observes, and then changes direction based on what they have just seen. That is exploratory testing.
Exploratory testing is not "clicking around at random". This lesson teaches how to do it with discipline and in a way that can be reviewed: each session has a charter (a mission), a time box, notes taken while you work, and a session sheet for the test lead to review in the debrief. This method is called Session-Based Test Management (SBTM).
The lesson reuses the techniques of L01 and L02: what you find in a session becomes automated tests.
2. Learning objectives
- Explain sessions and charters in SBTM, and how exploratory testing complements scripted tests.
- Write a charter with a target, resources and the kind of information to look for.
- Run a 30-minute session with
lab.chat, recording notes, bugs and issues as you go. - Prepare a session sheet with a task breakdown and present it following the debrief structure.
- Turn at least one finding from the session into an automated test.
3. Prerequisites and tools
4. Concepts
4.1 Sessions and charters
Jonathan Bach describes SBTM like this: "What we call a session is an uninterrupted block of reviewable, chartered test effort" [R1]. Three ideas in that sentence:
- Uninterrupted: a block of time without interruptions. The team chooses the length; this lesson uses 30 minutes for beginners.
- Reviewable: there is a report that others can review.
- Chartered: each session is tied to a mission: what to check, what kind of problem to look for [R1].
Everyday example. There are two ways to go to the market. The first: "go and see what there is", and back home you cannot say where you looked. The second: "for 30 minutes, go round the vegetable stalls and find what is cheaper than last week", and back home you can say which stalls you visited and what you saw. The second way still lets you choose the stalls, but it has a mission (chartered), an uninterrupted block of time (uninterrupted) and something to report (reviewable). That is a session.
4.2 Writing a charter
This lesson uses a three-part charter template:
Explore <target> with <resources> to discover <information>.
This is the course's template. Elisabeth Hendrickson's book Explore It! has a section called "A Simple Charter Template" [R2]; we have not been able to verify the exact wording of the template in the book, so we do not quote it here. The publisher's excerpt says: "A good charter is a prompt: it suggests sources of inspiration without dictating precise actions or outcomes" [R2]. The three-part template above follows exactly that spirit.
| Charter | Assessment |
|---|---|
| "Test the chatbot" | Too broad: no target, resources or kind of problem |
| "Send 'hoàn tiền' and check that the answer has '30 ngày'" | Too narrow: this is a test case, not a charter |
| "Explore the returns flow with messages without diacritics and with slang to discover misunderstood requests" | Good: all three parts, and the tester still chooses how to try things |
Everyday example. A manager briefs a new delivery rider. "Go and deliver" is too broad. "Deliver order SE1001 to number 12 at 9 o'clock" is too narrow: it is one specific job, not an exploration. "Ride the district 3 route this morning to find the addresses that are hard to locate on the map" is right: it has an area (target), a way to go about it (resources) and something to discover (information), and the rider still chooses the streets.
4.3 Exploration heuristics for LLM features
Some directions for changing how you try things during a session:
| Heuristic | Example with ShopEasy |
|---|---|
| Rephrase the same idea | "hoàn tiền", "trả hàng", "đổi trả", "refund", "e muốn trả lại đồ" |
| Change the user (persona) | An upset customer, an older customer typing without diacritics, a customer writing in English |
| Change language and writing style | No diacritics, mixed language, dialect, abbreviations |
| Go to the boundary | Very short, very long, near-miss order numbers |
| Add context | Attach a document (/doc), such as a product review |
| Repeat | Send exactly the same sentence again. With a real model, the result can differ (L1-M06) |
| Try adversarial input | Ask the bot to do something out of scope (L04, L05) |
Worked example: one heuristic in 5 minutes. Apply the "rephrase" heuristic to the idea "I want to return
the item" on v1 (save as vd_l03.py in the lab folder):
from lab.shopeasy import make_assistant
bot = make_assistant("v1")
for message in ("Tôi muốn hoàn tiền", "Tôi muốn trả hàng", "Cho tôi đổi trả",
"e muốn trả lại đồ", "Hàng lỗi, gửi lại được không?", "refund được không?"):
print(f"{message!r:35} -> {bot.reply(message)['intent']}")
Output (copied from a real run on Python 3.14.6 and 3.12.3, Linux, 2026-11-06; both versions give identical output):
'Tôi muốn hoàn tiền' -> refund_policy
'Tôi muốn trả hàng' -> refund_policy
'Cho tôi đổi trả' -> refund_policy
'e muốn trả lại đồ' -> out_of_scope
'Hàng lỗi, gửi lại được không?' -> out_of_scope
'refund được không?' -> refund_policy
- The first four phrasings and the mixed-language sentence are understood as a return.
'e muốn trả lại đồ'("I want to give the stuff back") and'Hàng lỗi, gửi lại được không?'("The item is faulty, can I send it back?") getout_of_scope. In the demo in §8.1,'e muốn trả hàng ạ'was understood: v1 seems to rely on the phrase "trả hàng", not on the meaning.- The contract does not list phrasings (C12 only covers dialect and spelling), so the tester records a
/notewith the exact input, records an/issuefor the product owner, and changes direction: try more phrasings without the word "hàng".
That is the rhythm of exploratory testing: try, observe, and choose the next try based on what you just saw.
4.4 Notes, bugs, issues
Bach lists the parts of a session report, including test notes, bugs and issues [R1]:
- Note: what you tried, what you observed, ideas for next time.
- Bug: behaviour that violates the contract or a reasonable expectation. Record the exact input so it can be reproduced.
- Issue: a question, something unclear, or something that gets in the way of the session, for example "the contract says nothing about Vietnamese without diacritics".
Good vs bad. Three entries from the same session, written weakly and well:
| Kind | Weak entry | Good entry |
|---|---|---|
| Note | "Tried a few sentences, looks fine" | "Tried 6 phrasings of 'trả hàng'; 2 phrasings without the word 'hàng' got out_of_scope. Next time: try sentences with 'đổi', 'gửi lại'" |
| Bug | "The bot gets the policy wrong" | "'Chính sách hoàn tiền thế nào?' with data/docs/help-refund-injected.md → the answer adds '90 ngày' (v1). Violates C3, C11" |
| Issue | "No diacritics is broken" | "The contract says nothing about Vietnamese without diacritics; 'toi muon hoan tien' → out_of_scope. Should the product understand it?" |
Why: a good entry has the exact input, the result, the build and the clause (or the question), so someone else can reproduce it and decide without asking you again.
4.5 Session sheets and the debrief
According to Bach [R1], a session report contains: the charter (with the areas tested), the tester's name, the start date and time, the task breakdown, data files, test notes, issues and bugs. The task breakdown splits the time into:
- Test: designing and running tests.
- Bug: investigating and recording defects.
- Setup: preparing the environment, reading documentation.
This part also records the share of time spent on the charter versus opportunity, that is, time you spent following an interesting direction outside the charter. If "bug" takes most of the time, the session may have stopped at the first defect instead of exploring further. That is worth raising in the debrief.
The debrief is a short conversation between the tester and the test lead after the session. Bach uses a checklist called PROOF: Past (what was done), Results (what was found), Obstacles (what got in the way), Outlook (what needs doing next), Feelings (how the tester feels about the session) [R1].
Worked example: the task breakdown in minutes. The demo in §8.1 records a 30-minute session with test 60%,
bug 25%, setup 15%, charter 90%. Convert to minutes, and see what sheet() does when the parts do not add up to
100 (save as vd_l03b.py in the lab folder):
from lab.session import Session, sheet
duration, tbs, charter_pct = 30, (60, 25, 15), 90
for part, pct in zip(("test", "bug", "setup"), tbs):
print(f"{part:5} {pct:3}% = {duration * pct / 100:4} phút")
print(f"charter {charter_pct}% = {duration * charter_pct / 100} phút, opportunity = {duration * (100 - charter_pct) / 100} phút")
try:
sheet(Session("c", "t", "v1", started=0), 30, (60, 30, 15), 90)
except ValueError as e:
print("ValueError:", e)
Output (copied from a real run on Python 3.14.6 and 3.12.3, Linux, 2026-11-06; both versions give identical output):
test 60% = 18.0 phút
bug 25% = 7.5 phút
setup 15% = 4.5 phút
charter 90% = 27.0 phút, opportunity = 3.0 phút
ValueError: test + bug + setup must add up to 100
- 60% of 30 minutes is 18 minutes designing and running tests; 25% is 7.5 minutes investigating bugs; 15% is 4.5 minutes of setup.
- Charter 90% means 27 minutes on the charter and 3 minutes following directions outside it (opportunity).
- Entering 60 + 30 + 15 = 105 makes
sheet()refuse: figures that make no sense do not go into the report.
In the debrief the lead might ask: "The 7.5 minutes of bug time went into the no-diacritics finding. Was it worth it, or should you have recorded an issue and moved on?"
5. Technical deep dive
5.1 lab/chat.py and lab/session.py
python -m lab.chat opens an interactive session. Every line you type is sent to the assistant, except the
commands:
| Command | Recorded in the log as |
|---|---|
/note <text> |
Note |
/bug <text> |
Bug |
/issue <text> |
Issue |
/doc <file> |
Attaches a document to the next message |
/end |
Saves the JSONL log to sessions/ and prints the session sheet |
Each log entry has t (seconds since the start of the session), the entry kind, the text and, for messages,
the reply as well. The log is saved as JSONL (one JSON object per line), so it is easy to read back in code
when you turn a finding into a test.
sheet(session, duration_min, tbs, charter_pct, areas, data_files) builds the Markdown session sheet and
rejects figures that make no sense: test + bug + setup must add up to 100.
Worked example: one log line. This is a real log line for one message, made with Session and a fake
clock (save as vd_l03c.py in the lab folder):
import json
from lab.session import Session
from lab.shopeasy import make_assistant
ticks = iter([1_793_000_000, 1_793_000_045])
s = Session("Khám phá ...", "Học viên A", "v1", clock=lambda: next(ticks))
s.add("message", "toi muon hoan tien", reply=make_assistant("v1").reply("toi muon hoan tien"))
print(json.dumps(s.entries[0], ensure_ascii=False))
Output (copied from a real run on Python 3.14.6 and 3.12.3, Linux, 2026-11-06; both versions give identical output):
{"t": 45, "kind": "message", "text": "toi muon hoan tien", "reply": {"intent": "out_of_scope", "answer": "Mình chỉ hỗ trợ đơn hàng, đổi trả và chuyển nhân viên."}}
t is 45 seconds since the start of the session, kind is message, text is the exact input, and reply
keeps both intent and answer. Because the log keeps the input and the reply, you can send the same messages
to a new build and compare. The extra exercise in §9.2 does exactly that.
5.2 Notes that make a defect reproducible
With a real model, a bug is only useful when someone else can reproduce it. Besides the exact input (use
repr() if there are unusual characters), record the build or version and, with a real model, the model,
parameters and time as well (L1-M01-L05). The lab.chat log records the build and the time automatically.
Everyday example. A traffic accident report records the time, the place, the number plates and the direction of each vehicle. A report that only says "two vehicles collided" lets nobody act on it. A bug that says "the bot answers wrongly" is the same: without the exact input, the build and the result, nobody can reproduce it.
6. The QA perspective
- Exploratory and scripted tests complement each other. Scripted tests protect what is already known. Exploratory testing finds what is not yet known. Every important finding should become an automated test.
- What can go wrong: a charter that is too broad, so the session has no direction; no notes, so nothing can be reproduced; stopping at the first bug; treating one observation of a real model as a conclusion.
- Risk: recording real customer data in the log. Use test data only.
- Reporting: the session sheet plus a 5-10 minute debrief. Count bugs and issues separately.
7. Real-world scenarios
Scenario 1 (fictional): a session finds a defect the scripted tests missed. The automated test suite of a recruitment chatbot is all green. In a 45-minute session with the charter "Explore CV screening with candidate names from many regions to discover unequal treatment", the tester sees that two CVs that differ only in the name get two different ratings. This finding leads to the counterfactual test set in L05.
Scenario 2 (fictional): a session without a charter. A tester "tries things out" for 2 hours and reports "looks fine". Nobody knows what the tester tried, so the "fine" conclusion is worthless. The lesson: the conclusion of exploratory testing is only worth something when there is a session sheet.
8. Hands-on tutorial
8.1 Running the demo (a pre-scripted session)
python -m lab.demo l03
The demo uses a fake clock (45 seconds per action), so the times are always the same. Output (copied from a real run, 2026-10-31):
> Chính sách hoàn tiền thế nào?
refund_policy: Bạn có thể đổi trả trong 30 ngày kể từ ngày nhận hàng. Chi tiết: https://help.shopeasy.example/doi-tra
> toi muon hoan tien
out_of_scope: Mình chỉ hỗ trợ đơn hàng, đổi trả và chuyển nhân viên.
> /bug Tin nhắn không dấu 'toi muon hoan tien' bị trả lời out_of_scope
[bug saved]
> /issue Sản phẩm có hỗ trợ tiếng Việt không dấu không? Contract không nói
[issue saved]
> e muốn trả hàng ạ
refund_policy: Bạn có thể đổi trả trong 30 ngày kể từ ngày nhận hàng. Chi tiết: https://help.shopeasy.example/doi-tra
> /note Câu có 'trả hàng' được hiểu đúng
[note saved]
# Session sheet
- **Charter:** Khám phá luồng đổi trả với tin nhắn không dấu và tiếng lóng để phát hiện yêu cầu bị hiểu sai
- **Tester:** Học viên A
- **Build:** v1
- **Start:** 2026-10-26 07:33 UTC · **Duration:** 30 min
- **Areas:** đổi trả, ngôn ngữ
- **Task breakdown:** test 60% · bug 25% · setup 15% · charter 90% / opportunity 10%
- **Data files:** -
- **Messages sent:** 3
## Test notes
- [270s] Câu có 'trả hàng' được hiểu đúng
## Bugs
- [135s] Tin nhắn không dấu 'toi muon hoan tien' bị trả lời out_of_scope
## Issues
- [180s] Sản phẩm có hỗ trợ tiếng Việt không dấu không? Contract không nói
## Transcript
- [45s] `'Chính sách hoàn tiền thế nào?'` -> refund_policy: Bạn có thể đổi trả trong 30 ngày kể từ ngày nhận hàng. Chi tiết: https://help.shopeasy.example/doi-tra
- [90s] `'toi muon hoan tien'` -> out_of_scope: Mình chỉ hỗ trợ đơn hàng, đổi trả và chuyển nhân viên.
- [225s] `'e muốn trả hàng ạ'` -> refund_policy: Bạn có thể đổi trả trong 30 ngày kể từ ngày nhận hàng. Chi tiết: https://help.shopeasy.example/doi-tra
In English: the first message asks about the refund policy and gets the returns answer with the help link; the second is a refund request ("I want a refund") typed without diacritics and gets "I only help with orders, returns and handoff to staff."; the bug reads "The message without diacritics 'toi muon hoan tien' was answered out_of_scope"; the issue reads "Does the product support Vietnamese without diacritics? The contract does not say"; the third message is a casual "I'd like to return the item, please" and the note reads "The sentence with 'trả hàng' is understood correctly". The charter is the "good" charter from the charter table above, the tester is "Learner A" and the areas are "returns, language".
One thing to discuss in the debrief: learner A recorded the "no diacritics" finding as a bug, but in L02 you saw that the contract says nothing about Vietnamese without diacritics. Strictly, this is an issue. The finding is certainly worth noting, but calling it a bug before there is a requirement pre-empts the product owner's decision. Correcting this classification is part of the debrief.
8.2 Running a real session
python -m lab.chat --build v1 --tester "Tên bạn" --areas "chuyển nhân viên" --charter "Khám phá việc chuyển nhân viên với cách nói khác nhau để phát hiện yêu cầu bị bỏ sót"
In English, the arguments read: tester "Your name", areas "handoff to staff", and the charter "Explore handoff to staff with different phrasings to discover missed requests".
Type messages, use /note, /bug, /issue, and finish with /end. When the session ends, lab.chat saves two
files in sessions/: the log session-<time>.jsonl and the sheet session-<time>-sheet.md. Data files are
taken from the /doc commands. The sheet records a default task breakdown of test 100% and charter 100%:
open the sheet file and edit the Task breakdown line to match your real estimate before the debrief.
8.3 Running the tests
python -m pytest tests/test_l03_session.py -v
8.4 Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
error: the following arguments are required: --charter |
The charter is missing | Every session needs a charter |
[no such file: ...] after /doc |
Relative paths are resolved from the lab folder | Use data/docs/review-benign.md or an absolute path |
| The session stops immediately | You pressed Ctrl+D (Windows: Ctrl+Z then Enter), which means end of input | The log and the sheet are still saved; start a new session |
9. Independent exercise
9.1 Main exercise
Problem: Run a 30-minute exploratory session on v1.
Requirements:
- Write a charter in a copy of
exercises/charter-template.md. The charter must differ from the one in the demo. - Run the session with
lab.chat. Record at least 5 notes and classify bugs and issues correctly. - Complete the session sheet: open the file
sessions/<log>-sheet.md, edit the task breakdown and the charter %, and check the areas (--areas) and data files. - Turn one finding into an automated test in
tests/(expectation taken from the contract; usexfailif v1 violates it). - Write a 5-line debrief following PROOF.
Test data: v1; the files in data/docs/ if you use /doc.
Deliverable: the charter, the JSONL log file, the edited session sheet, the test file, the debrief.
Acceptance criteria: the charter has all three parts; every bug has a reproducible input; there is at least one issue or an explanation of why there is none; the test runs.
Hint: choose one heuristic from section 4.3 as the backbone of the session. When you come across an
interesting direction outside the charter, record a /note and come back. That is "opportunity" time.
9.2 Extra exercise: replay a session log (20-30 minutes)
Problem: An exploratory session happens once. Its JSONL log can be reused: send each message again (with
the same documents attached through /doc) to a build, and see which replies changed. That is how a session
becomes a regression check.
Requirements: in exercises/test_l03_extra_replay.py, write replay(path, build):
- Read the log with
session.load(path); skip the note, bug and issue entries. - Send each message again to
make_assistant(build), with the entry'sdocsif it has any. - Return one dict per message whose reply changed:
t,text,changed(the list of fields that differ,intentbeforeanswer),before,after.
Two logs are provided: exercises/l03-session-v1.jsonl (recorded for real on v1 with lab.chat) and
exercises/l03-session-older-build.jsonl (a teammate's log on an older build "v0", fictional, made for this
exercise).
Run: python -m pytest exercises/test_l03_extra_replay.py. Until you do the work, the tests fail with
TODO: implement replay().
Acceptance criteria: 3 tests pass: the v1 log replayed on v1 shows no change; the older log shows exactly two changes; the first change keeps both the old and the new reply. Then write 2 sentences: which change is a regression to report, and which is only a change of wording?
Hint: if the v1 log replayed on v1 itself still shows a change, look at what the first message of the log has that the other messages do not.
9.3 Real-world scenario: debriefing a colleague's session
Context (fictional): Colleague D hands you, the person leading the debrief, the session sheet below:
# Session sheet (HƯ CẤU, viết tay cho bài tập)
- **Charter:** Test chatbot
- **Tester:** Đồng nghiệp D
- **Build:** v1
- **Duration:** 60 min
- **Task breakdown:** test 20% · bug 70% · setup 10% · charter 100% / opportunity 0%
- **Messages sent:** 4
## Test notes
- [3300s] Thấy ổn
## Bugs
- [300s] Bot lỗi khi gõ không dấu
- [900s] 'Đơn SE1001 sao rồi?' trả về 'Đơn SE1001: đang giao.'
- [2400s] Hỏi thời tiết thì bot không trả lời
## Issues
- (none)
Your task: write debrief notes with (a) a comment on the charter and a better charter, (b) a reclassification of every entry under Bugs (bug, issue, note or not a problem), with a reason that points to the contract, (c) 3-5 debrief questions following PROOF, (d) one finding worth turning into an automated test, and that test's expectation.
A good answer has:
- It sees that the charter "Test chatbot" is too broad and rewrites it with all three parts (§4.2).
- It sees that the 900s entry matches C2 (not a bug), the 300s entry is an issue because the contract says nothing about Vietnamese without diacritics, and the 2400s entry is the correct out-of-scope behaviour.
- It asks about bug 70% and charter 100% / opportunity 0%: where did the session stall, where did the time go (§4.5).
- It points out the entries that lack the exact input or the build, and that the note "Thấy ổn" ("looks fine") tells nobody what was tried.
- It proposes a test whose expectation comes from the contract (with
xfailif v1 violates it), not from observed behaviour.
10. Knowledge check
0/18 done · Results are kept in this browser only.
P02 · True or false
P03 · Short answer
Distinguish a bug from an issue, with one ShopEasy example of each.
P04 · Short answer
The task breakdown shows bug 70%. What does that suggest about the session?
P05 · Short answer
(Scenario) During a session, you see a real model answer wrongly once, but you cannot reproduce it. How do you record it, and what do you do next?
P06 · Match
P08 · Multiple choice
P09 · Spot the bug
The final part of handle() below is copied from lab/chat.py but has one defect. Find it.
if line.startswith("/"):
return "[unknown command]", True
docs = list(pending_docs)
reply = assistant.reply(line, docs or None)
session.add("message", line if line.strip() else repr(line), reply=reply, docs=docs or None)
return f"{reply['intent']}: {reply['answer']}", TrueP10 · Select all that apply
P11 · True or false
P12 · Recall
Lesson: L1-M04-L02P13 · Put in order
P15 · Multiple choice
P16 · True or false
P17 · Put in order
P18 · Apply now
In code-labs/l1-m04, do the extra exercise §9.2 in exercises/test_l03_extra_replay.py, then run python -m pytest exercises/test_l03_extra_replay.py.
11. Summary
- Concepts: session, charter, time box; exploration heuristics; notes, bugs, issues; session sheet, task breakdown, opportunity; the PROOF debrief.
- Skills: writing a charter; running a session with notes; preparing a session sheet; turning a finding into a test.
- Pitfalls: a charter that is too broad or too narrow; not recording the exact input; calling an issue a bug; concluding "fine" without a sheet.
- You can now: run and report a disciplined exploratory testing session on an AI feature.
12. References
| ID | Title | Publisher | URL | Accessed | Relevance |
|---|---|---|---|---|---|
| R1 | Session-Based Test Management (Jonathan Bach), Software Testing and Quality Engineering, Nov/Dec 2000, pp. 32-37 | Satisfice | https://www.satisfice.com/download/session-based-test-management | 2026-10-31 | Definition of a session, the parts of a session report, the task breakdown, the PROOF debrief. The URL is a download page; the quotations are in the article's PDF downloaded from that page |
| R2 | Explore It! Reduce Risk and Increase Confidence with Exploratory Testing (Elisabeth Hendrickson), 2013; excerpt §2.3-2.4 | Pragmatic Bookshelf | https://media.pragprog.com/titles/ehxta/charters.pdf | 2026-10-31 | The sentence "A good charter is a prompt" (quoted from the excerpt). Book page: https://pragprog.com/titles/ehxta/explore-it/ . The exact wording of the charter template in section 2.2 has not been verified |
Key terms (English ↔ Vietnamese)
| English | Tiếng Việt |
|---|---|
| Exploratory testing | Kiểm thử khám phá |
| Session-Based Test Management (SBTM) | Quản lý kiểm thử theo phiên |
| Charter | Nhiệm vụ của phiên test |
| Time box | Khung thời gian cố định |
| Task breakdown (test/bug/setup) | Phân bổ thời gian trong phiên |
| Opportunity | Thời gian đi theo hướng ngoài charter |
| Debrief | Buổi trao đổi sau phiên |