Learn Everything

Paths/Claude Engineer/Testing with Claude Code / Write the Test

Guided Taskbeginnerubuntu:24.04Ask AI

Ask for the Failing Test First

A test that fails first proves it can fail at all. Write the brief that asks for one.

Validator

⏱ 0:00

IDLE — checks run live as you type commands; submit when done

01Requirements

live checks
  • Directory ~/.claude/testing exists○
  • File ~/.claude/testing/brief.md exists○
  • The brief states the behaviour and the case○
  • The brief states that the test must be seen failing○

02Walkthrough

4 steps
  1. 01

    Create the testing directory

    The briefs live with the rest of the Claude configuration.

    mkdir -p ~/.claude/testing
  2. 02

    Write the behaviour and the case

    One behaviour, one case. The agent writes the test from the behaviour, not from the code it will later change.

    echo '# Test brief\n\n## The behaviour\n\nThe refund endpoint refuses a refund larger than the captured amount.\n\n## The case\n\nA refund of 120 on a capture of 100.' > ~/.claude/testing/brief.md
  3. 03

    Write the ordering rule

    Write the test, run it and watch it fail, and only then write the implementation. The failure is the proof the test works.

    echo '\n## The rule\n\nWrite the test before the implementation, then run it and watch it fail. The failing output is the proof that the test is testing something.' >> ~/.claude/testing/brief.md
  4. 04

    Verify and submit

    cat the brief, then submit for validation.

    cat ~/.claude/testing/brief.md

03Stuck?

0 of 3 revealed

Take a hint without losing the lab — each one points at the thing to look at, not at the answer.

04AI Tutor

guides, never solves

Tell me what you're stuck on — I'll nudge, not solve. Which requirement are you looking at?

04Notebook

saved locally in this browser

learner@lab — ubuntu:24.04

↑/↓ recalls commands · Ctrl+Enter submits · type help for the command list