testing-strategy
The craft of a test plan: for each criterion, the behavior that changes, what can break, the tests that exist, the lowest layer, one negative case, and whether a new test is needed. Use when a plan names its Proof, before the first test of a slice, or for the regression tests of a fix.
- License 许可
- MIT
- 所属仓库
- lamtran8401/nook
- 最近更新
- 2026-10-27
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- testing-strategy
- description
- The craft of a test plan: for each criterion, the behavior that changes, what can break, the tests that exist, the lowest layer, one negative case, and whether a new test is needed. Use when a plan names its Proof, before the first test of a slice, or for the regression tests of a fix.
- user-invocable
- false
03 SKILL.md 正文
Goal: the fewest tests that fail when the behavior breaks. A test proves a behavior; a test that proves the code you just wrote proves nothing. Many tests that cannot fail cost CI time and hide the real gaps. Write one test for each behavior of a criterion and each negative case, never one test for each function. The layer follows the convention of the area or the rule of the team.
The five questions
Answer them in your notes before the first test of a slice. One or two lines each.
- Which behavior changes? Name it from the criterion: an input, an action and the visible result.
- What can break? The inputs and the states: empty, large, wrong, missing, at the same time. The callers of the code you change.
- Which test of the area proves part of it already? Search the tests next to the code and the tests of the callers. Read them.
- Which layer is the lowest one that proves it with confidence? See the table.
- Is a new test necessary? When a test proves the behavior already, add a case to it. Change an old test only because the criterion changed.
The layers
| Layer | Proves | Example |
|---|---|---|
| unit | one function or one rule of the logic: fast, many cases, no edge of the system | the public status list has 5 entries |
| service edge | a request in, a response out: the contract, the validation, the error codes | GET /shipments?status=x returns only the rows with status x |
| component | what a user sees and does: render, act, assert the text or the state | the banner reads "Unable to filter" when the query fails |
| integration | two parts that talk: a query against a real schema, a call between two services | the filter uses the index |
- Pick the lowest layer that sees the behavior. A rule of the logic is a unit test, not an integration test.
- A behavior that shows only at the edge (a status code, an error text) is a service-edge or a component test.
- One negative case for each criterion: an input or a state that the behavior must refuse or leave unchanged.
What you write down
AC2 (a status narrows the list)
changes GET /shipments?status=x returns only the shipments with status x
breaks unknown status, no status, 500 rows, the export that uses the same query
exists list.test.ts "returns all shipments" covers no status
layer service edge: list.test.ts
tests new "filters by status"; new "an unknown status returns an empty list"; extend nothing
Gotchas
- A test that repeats the formula of the code passes when the formula is wrong. Write the expected value by hand.
- A test that checks only that a mock was called proves the mock. Assert the result.
- Two tests that prove one behavior on one layer double the cost and add no proof. Keep one.
- A test for a behavior that the criteria do not name is out of scope. Name it in your summary instead.
- Do not delete or weaken an old test to make room. A test that is wrong now is a question for the lead.
04 同仓库更多 Skills
yolo
Run an item alone from its state to the owner's accept: the lead runs the phases, records each guess, passes the plan gate with proceed, and stops at a stop rule. Use when the owner types /yolo with an id, a prompt, or nothing.
write-walkthrough
Write walkthrough.md, the explanation of finished work: what works now in plain words, the changed files, where to start reading, the key code, the met criteria, how to try it, the risks. It is the source of the Walkthrough tab of the web app. Use after /qa, or for a question about the code.
wiki-tidy
Find what is wrong in the wiki: broken links, pages with no index line, lines too near the code, stale epic pages, topics with no source, two pages on one topic, adjectives with no example. Fix the mechanical part after one yes; list the rest. Use when the owner says tidy the wiki, or after many pages changed.
wiki-merge
Merge related wiki pages into one complete page: the pages of the features of one process or epic become one page with the flow from end to end. The old pages move to the archive after the owner's yes, and their links point at the new page. Use when the owner says merge these pages, or when wiki-tidy finds pages on one topic.
wiki-ask
Answer a question from the wiki: the index first, then only the pages whose line matches, an answer in a few lines with a link to each page. Use when the owner asks what the wiki says, or asks why or how about a known topic. Not to add a page: wiki-add.
wiki-add
Keep the lesson of a source in the wiki: a page in the shelf business/ or tech/ with its main points, a real example for each, the gotchas and the link of the source; written after the owner's yes. Use when the owner says add this to the wiki, keep this, or gives a PRD, a ticket, notes or an article to keep.