GENAI 102
M02 · L08
Testing & Debugging

Does It Still Work?

Two everyday questions run through every project. Tests tell you the code still works. Debugging is how you find out why it doesn’t. This lesson gives you a practical grip on both.

01 / 08
GENAI 102
M02 · L08
Three Kinds

Tests Come in Layers

They differ by how much of the system each one exercises — from one small piece to the whole thing.

  • Unit — checks one small piece on its own, like a single function.
  • Integration — checks that pieces work together correctly.
  • End-to-end — runs the whole flow the way a real user would.
02 / 08
GENAI 102
M02 · L08
The Core Idea

What a Test Actually Is

A test is just code that runs your code with a known input and asserts the expected output. If the two disagree, the test fails.

Why it matters
Run your tests automatically, and a change that breaks something is caught immediately — not weeks later by a user.
03 / 08
GENAI 102
M02 · L08
Finding the Why

Debugging Is a Method

When something breaks, don’t guess — work through it in order.

  • Reproduce the bug reliably, so you can tell when it’s fixed.
  • Read the stack trace — it names the file and line where things went wrong.
  • Form a hypothesis about the cause.
  • Change one thing, then check — and repeat until it holds.
04 / 08
GENAI 102
M02 · L08
Why This Matters Here

How You Trust an Agent

Tests are how you trust the code a coding agent writes for you. If the tests pass, the change is probably safe. This is the everyday version of verify, don’t trust blindly.

05 / 08
GENAI 102
Build It
From Concept to Capstone

Build It

How to implement: pick one function in your tool and write a single test — given this input, expect this output. Then run it and watch it pass.

  • Weekly AI Tasks tracker — a test like “this message parses into this task” catches regressions in the parser, and is the seed of the evals you build in Module 8.
  • Personal brand site — a simple check that every project link resolves and every claim has a source keeps it honest.
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

Tests come in layers — unit, integration, end-to-end — and each one runs your code with a known input and asserts the result. Debugging is a method: reproduce, read the trace, hypothesise, change one thing, check. Together they are how you trust code, including an agent’s.

08 / 08