Challenges
Short exercises with automatic feedback. Some ask you to write tests that catch bugs we planted; others ask for code that passes checks you cannot see. Each path goes from the basics up, one idea per challenge.
Everything runs in your browser, with no signup. Solved challenges are remembered on this device only (see how challenges work).
Your first tests
FoundationsWrite tests that catch real bugs: test both sides of a rule, the exact boundary, and one broken rule at a time.
- Test both sides of a ruleOne rule, one boundary. Write the tests that tell a correct age check from a broken one.Write the tests · about 10 min
- Every boundary, including zeroA fee with a free-shipping threshold and an error case. Find the three lines the rules draw.Write the tests · about 15 min
- Break one rule at a timeThree rules joined by AND. A password that breaks two rules at once hides which check is missing.Write the tests · about 15 min
- Every combination of conditionsTwo yes/no conditions make four combinations, and each one is its own rule. A decision table lists them all.Write the tests · about 15 min
- What can happen, and what cannotAn order moves through states. Test every allowed move, and at least one forbidden move from each state.Write the tests · about 20 min
Test-driven practice
PractitionerMake the tests pass, then find out what the visible tests did not ask. Finish by testing a class with state and errors.
- Slugs: pass the tests you cannot seeTurn titles into URL slugs. The visible tests are the happy path; the rules in the brief are the whole job.Write the code · about 20 min
- A cart total that survives the edge casesMoney, coupons and errors. Floating point, empty carts and unknown coupons are in the rules, not in the visible tests.Write the code · about 25 min
- Test a class with state and errorsNow you write the tests. Check the state after each action, the error messages, and the edge where the balance hits zero.Write the tests · about 20 min
How challenges work
- Write the tests: your tests run against the correct code, where they must pass, and against several broken versions, where at least one must fail. A bug that gets through is shown so you can see what was not tested.
- Write the code: you see some tests; hidden checks cover the other rules in the brief. Every hidden check follows from a written rule.
- Grading is plain code, the same every time. No AI decides whether you passed.
- Your code runs in an isolated Web Worker in this browser and is never sent anywhere. Hidden checks are hidden from the page, not secret: they are in the page source, because the point is practice, not an exam.
- Solved challenges are stored in this browser under the
lab-progresskey, with no identifier. Clearing site data removes them.