lecture 2 of 120 completed

Understand the feature before you automate it

A ticket said "large claims need a receipt" and gave no number. Two AI tools wrote test cases from it, and neither could give the number. Somebody has to go and find it.

What you'll learn

  • What an AI tool does with a ticket that leaves the rules out
  • The four places to look for a rule: the ticket, the written policy, people and the app
  • How to write a feature note that keeps rules apart from things you only observed

This is a ticket for a new feature. Read it the way a tester reads it, and look for what it does not say.

CD-214 Submit an expense claim

As an employee, I want to submit an expense claim, so that the company pays me back.

Acceptance criteria
- The form has Amount, Category and Receipt number.
- Large claims need a receipt.
- A claim over the limit is refused.
- The new claim appears in "Your claims" as Pending.
- An employee can withdraw a pending claim.

Acceptance criteria are the conditions the work must meet before the team calls it done.

"Large claims" has no number. "The limit" has no number. "Over the limit" does not say whether a claim of exactly the limit is allowed. Nothing says what "withdraw" does to the claim.

Many tickets look like this. The person who wrote it knows the numbers, and did not think to write them down.

What two tools did with it

We sent the ticket to two AI tools, with one sentence above it: "Write test cases for this ticket." The tools had the text and nothing else. This is one of the recorded runs described in lecture 1, under "How these runs were made".

We expected invented numbers, such as a limit of 1000. That did not happen. Both tools saw the gaps.

Claude Code wrote 39 test cases. It opened with this:

"The ticket leaves some values undefined, so these cases use placeholders: R, the amount above which a receipt is required, and L, the maximum claim amount."

Its cases then say things like "Amount = R - 0.01" and "Amount = L + 0.01". It ended with six questions for the product owner. The product owner or product manager is the person who decides what the feature should do.

Codex wrote 8 cases, and it ended like this:

"Clarifications needed before the suite can be finalized: the threshold and limit values; whether the threshold is inclusive; whether a receipt number alone satisfies the receipt requirement; which fields and amount formats are valid; and the expected status or display after withdrawal."

A threshold is the value where a rule starts to apply. "Inclusive" means the value itself is counted.

Both lists of questions are good. You could send them to the product manager as they are.

But look at what you have. You cannot run a test case that says "Amount = L + 0.01". Nobody can type L into a form. The tools found the questions. They could not find the answers, because the answers are not in the ticket.

One more thing about the longer reply. Several of its 39 cases are about things the ticket never mentions: one employee seeing another employee's claims, more than one currency, and a claim that is approved at the moment it is withdrawn. These may be good questions to ask. They are not test cases yet, because nobody has said what should happen.

Four places to look

The answers exist somewhere. In most teams they are in four places, and a tester visits all four.

1. The ticket and what it links to. Read the comments under the ticket and any linked design. Decisions are often made in a comment and never copied into the description.

2. The written rules. For Claim Desk, the numbers are in the company's finance policy.

3.1 The amount of a claim is greater than 0 and has at most two decimals.
3.2 One claim can be at most 500.00. A higher claim is submitted by the employee's manager.
3.4 A claim of 50.00 or more needs a receipt number. Below 50.00 the receipt number is optional.

Now "large" means 50.00 or more, and "the limit" is 500.00. Notice the exact words: "50.00 or more" and "at most 500.00". They tell you what happens at exactly 50.00 and exactly 500.00.

3. People. Some answers are written nowhere. Ask short questions that have one answer.

  • To the product manager: "After Withdraw, does the claim leave the list or stay with a new status? Does a withdrawn claim still count in the pending total?"
  • To the developer: "Where is the limit checked, in the page or on the server? What claims does a new user start with?"

Write down who answered and when. An answer in a chat message is lost in a week.

4. The app itself. Open the feature and use it by hand for fifteen minutes before you write any test. Open the browser's developer tools and watch the Network tab, which lists every request the page sends to the server.

In fifteen minutes with Claim Desk you would see these things.

  • Saving is not instant. The page shows "Saving..." for up to about a second, then "Claim saved".
  • The page opens with three claims and a pending total of 138.50.
  • An approved claim has no Withdraw button.
  • The page sends each claim to the server and shows what the server answers. So the rules are checked on the server.

None of this was in the ticket or the policy. All of it matters for a test. The first point alone decides how your test must wait.

Teams often lose a day when this step is skipped. The tests get written first, and the questions come up one at a time, each as a failing test.

What you saw is not a rule

The fourth place needs care. What you see in the app is what the app does today. Lecture 1 showed what happens when a test treats that as the rule.

So keep two lists. A rule has a source outside the app. An observation has only the app. "An approved claim has no Withdraw button" is an observation until somebody confirms that it is intended.

The feature note

Put what you found on one page. This is the note for CD-214.

Feature note: expense claims in Claim Desk (ticket CD-214)

Rules, each with its source:
1. The amount is a number greater than 0, with at most two decimals. Otherwise the page says "Enter an amount greater than 0." Source: finance policy 3.1.
2. One claim can be at most 500.00. A claim of exactly 500.00 is allowed. Above that, the page says "Claims above 500.00 must be submitted by your manager." Source: finance policy 3.2, confirmed by the product manager in the ticket.
3. A claim of 50.00 or more needs a receipt number. Below 50.00 the receipt number is optional. Without it, the page says "Add a receipt number for claims of 50.00 or more." Source: finance policy 3.4.
4. A saved claim appears at the top of "Your claims" with a new claim number, the category that was chosen and the status Pending. "Pending total" rises by the amount. Source: ticket CD-214.
5. Withdraw opens a dialog that names the claim and its amount. "Keep claim" changes nothing. "Withdraw claim" sets that claim, and no other, to Withdrawn. The claim stays in the list. "Pending total" falls by its amount. Source: ticket CD-214. The product manager confirmed that withdrawn claims do not count in the total.

Observed on the page, not confirmed by anyone:
- Saving takes up to about one second. The page shows "Saving..." and then "Claim saved".
- The page opens with three claims: C-1003 Equipment 240.00 Approved, C-1002 Meals 18.50 Pending, C-1001 Travel 120.00 Pending. The pending total is 138.50.
- An approved claim has no Withdraw button.

Open questions, not answered yet:
- Is a duplicate claim allowed?
- What happens to the form after a refused claim?

It has three parts.

  • Rules, each with its source. A rule without a source is a guess, even when it is right.
  • Observed, not confirmed. Useful facts about the app that no person and no document has approved.
  • Open questions. What you still do not know. An empty list here usually means you have not looked hard enough.

A weak note and a useful one

Here is a line from a weak note:

Big claims need a receipt. The limit is 500.

Try to write a test from it. You do not know what "big" means. You do not know whether 500.00 itself is allowed. You do not know what the page says when it refuses. And if the app disagrees with this note, you have nothing to point to.

Now the same rule from the useful note:

A claim of 50.00 or more needs a receipt number. Below 50.00 the receipt number is optional. Without it, the page says "Add a receipt number for claims of 50.00 or more." Source: finance policy 3.4.

This line gives you three tests: 49.99 without a receipt is saved, 50.00 without a receipt is refused, and the message has this text. If the app disagrees, you can name the policy line.

Where the tool helps in this step

A tool cannot visit the four places for you. It can help with what you bring back.

  • Paste the ticket and ask for the questions it leaves open. You saw above that both tools did this well.
  • Paste the policy and your draft note, and ask which rule in the policy has no line in the note.
  • Ask it to turn your rough notes into the three-part shape. Then read every line, because a tidy note looks more certain than rough notes do.

The note is yours. If you cannot say where a line came from, take it out or move it to "open questions".

Your exercise. The exercise asks you to prove that logging out really ends the session. Before you write the test, use the app by hand. Find out what a logged-out user can still see and do, and decide what "really logged out" means. Then write the test.

Remember this:

  • A ticket often leaves out the numbers. A tool can list the gaps, but it cannot fill them.
  • Look in four places: the ticket and its links, the written rules, people and the app.
  • Keep rules apart from observations. A rule has a source outside the app.
  • Write a feature note with rules and sources, observations and open questions.

Reference: Best practices.

now prove it

Reading is the setup. Solve this problem in the editor. We break the app on purpose to check your test would catch it.

The next lesson is “You write the cases, the AI reviews them”. It is the first one that needs a course plan. Anyone can read its opening. See course plans