The code passes your unit tests.
But does it do what you really want?

UnitTestGame pairs you with a maliciously compliant AI bot. It writes the laziest code that satisfies your unit tests. And nothing more. Your job: write unit tests until the program is right.

I want to add this unit test.

powerMode(20) === "NORMAL MODE"
this is you
with your first unit test
function powerMode(batteryLevel) {
return "NORMAL MODE"
}

the AI bot
the function it wrote passes your unit test but it doesn't generalize 👎

I want to add this unit test.

powerMode(19) === "LOW POWER MODE"
your second unit test
function powerMode(batteryLevel) {
if (batteryLevel >= 20) return "NORMAL MODE"
return "LOW POWER MODE"
}
the rewritten function passes both unit tests and now it generalizes 👍

Learn Test-Driven Development by feel

No lectures. No quizzes. Just an AI bot exploiting every hole in your unit tests.

  1. 1 Read the spec

    See what the function is supposed to do, in plain input → output terms.

  2. 2 Watch it cheat

    The AI bot ships the laziest code that satisfies exactly what you tested.

  3. 3 Catch the gap

    Spot the edge case it dodged, and add a unit test that exposes it.

  4. 4 Tighten until solid

    Repeat until there's no shortcut left. Level completed!

For developers who want to prevent bugs

It plays like a game. It sticks like a habit. It changes your way of testing.

Ten levels, ten ways to get outsmarted

Each one looks simple. Until the AI bot finds another range you forgot to test.

  1. 0 easy

    Battery Level

    The AI bot shows you first. Then it's your turn.

  2. 1 easy

    Voting Age

    One birthday. Two possible outcomes.

  3. 2 easy

    Wind Scale

    Three thresholds stand between calm and storm.

  4. 3 medium

    Review

    Price and quality, working against each other.

  5. 4 medium

    Discount

    A full cart, a member card, or both at once.

  6. 5 medium

    FizzBuzz

    Everyone knows FizzBuzz. The bot doesn't.

  7. 6 medium

    Leap Year

    An exception to the exception to the rule.

  8. 7 hard

    Triangle Type

    Every side length changes the verdict.

  9. 8 hard

    Speed Display

    The physical display has limits. Find them all.

  10. 9 hard

    Parking Fee

    Free, flat, or by the minute. What now?

Frequently Asked Questions

No sales pitch. Just answers.

The AI bot is waiting for you. Don't get fooled.

Click the button, follow the instructions, and see what the AI bot tries to get away with.

Play UnitTestGame for free →