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

UnitTestGame pairs you with an evasive AI bot. It writes correct 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.

isAllowedToVote(18) === true
this is you ↑ with your first unit test
function isAllowedToVote(age) {
return true
}
↑ this is the AI bot its first function passes your unit test but it doesn't generalize 👎

I want to add this unit test.

isAllowedToVote(17) === false
this is you again ↑ now with your second unit test
function isAllowedToVote(age) {
if (age >= 18) return true
return false
}
↑ this is the AI bot again its second function passes both unit tests and now it generalizes 👍

Learn to write unit tests by feel

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

  1. Read the spec

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

  2. Watch it cheat

    The AI bot writes correct code that satisfies exactly what you tested.

  3. Catch the gap

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

  4. Keep going until it's right

    Repeat until there's no other way. Level completed!

For developers who want to prevent bugs

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

Ten levels, ten ways to get outsmarted

Each one looks simple. Until the AI bot finds something you haven't tested yet.

  1. 0 easy

    Battery Level

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

  2. 1 easy

    Voting Age

    Can you vote? 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 AI bot too.

  7. 6 medium

    Leap Year

    An exception to the exception to the rule.

  8. 7 hard

    Triangle Type

    Every side 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 →