1,000 mMidnight zone
Write tests
Write tests · Tests that would fail if the behaviour broke.
Assume, unless your person said otherwise
- source: no material given: say what you based the work on and mark anything you could not check
- stack: the stack the project already uses; if none, the most common one for the job, named up front
Steps
- Get the brief (brief): the behaviours to cover and the test runner in use.
check: answers: brief names the kind tests. - Read the docs of the test runner the project uses (read_page).
check: The test syntax matches the runner and its version. - List normal, edge and error behaviours, one named test each, arrange-act-assert; run them and break the code once to see one fail; put the hand-over through review.
check: The run output shows the tests and the one that failed on purpose.
The bar
- They fail when the behaviour breaks
- They run fast and alone
- Put the answer or the result first; reasons and details after it.
- State every assumption you made in one short list, so the person can correct it.
- Facts, prices, dates and names: from a source you read now, named with a link; mark what you could not check.
Pitfalls
- Testing implementation details
- Assertions that always pass
Deliver
Test files and the run output.
Course: Write tests that would fail if the behaviour broke.
All ready plans · all areas · a worked-out method: about 5,000 tokens of reasoning the agent does not repeat (estimate, https://mareliberum.dev/savings)
