GENAI 102
M04 · L04
Shaping the Build

Define Success First

Before the design, before a single line is built, write the tests — or at least the acceptance criteria. That way “correct” is defined before you start, not argued about after.

01 / 08
GENAI 102
M04 · L04
The Idea

What Test-First Means

You describe the behaviour you expect as checks, and only then build toward them.

  • Describe expected behaviour as checks first — write down what a correct result looks like.
  • Build until the checks pass — the work is done when they go green.
  • The checks are the definition of done — not a feeling, not a demo.
02 / 08
GENAI 102
M04 · L04
Why It Matters Now

A Target for the Agent

Test-first is especially powerful when a coding agent does the building. Hand it the tests to satisfy and two things change at once.

What you gain
The agent gets an unambiguous target to aim at — and you get an automatic verifier that tells you, without judgment calls, whether it succeeded.
03 / 08
GENAI 102
M04 · L04
The Rhythm

TDD in One Loop

Test-driven development is a small loop you repeat, one behaviour at a time.

  • Write a failing test — state what should be true; it fails because nothing does it yet.
  • Make it pass — build the smallest thing that turns it green.
  • Clean up — tidy the code now that a test protects it.
  • Repeat — move to the next behaviour and go again.
04 / 08
GENAI 102
M04 · L04
Where This Leads

A Preview of Module 8

Keep this idea in mind — it comes back. Evaluation-driven development is this same test-first discipline applied to unpredictable AI outputs.

The connection
When an answer can vary run to run, you can’t eyeball “correct” — so you define success as a set of evaluations, and build the AI feature until it passes them.
05 / 08
GENAI 102
Build It
Apply It to Your Capstone

Build It

How to implement: for one core feature of your capstone, write the acceptance test first — “given X, expect Y” — then build only until it passes.

  • Weekly AI Tasks tracker — write “this message parses into this task” as a test before building the parser; it becomes a Module 8 eval.
  • Personal brand site — write the check “every project has a source link” first, then generate to satisfy it.
06 / 08
GENAI 102
Knowledge Check

Check what stuck

Three questions from this lesson. Answer to see why — the explanation appears whether you were right or wrong. Nothing is scored or saved.

Question 1 of 0
Score 0/0

07 / 08
GENAI 102
Summary
Recap

What you learned

Define “done” as checks before you build; hand those checks to your agent as a target and an automatic verifier; work the small TDD loop — and know this is the seed of Module 8’s evaluation-driven development.

08 / 08