Account lockout after failed sign-ins
intermediate Boundary value analysis Challenge 9 of 10
A sign-in service locks an account after repeated failures. Write tests that expose every bug in nine buggy implementations of the lockout check.
Requirements
- The account is
lockedwhen there have been at least 5 failed attempts in a row and the last failure was less than 15 minutes ago. - Otherwise it is
allowed. - Negative values for either input are
invalid. - Every test needs an expected result that agrees with these rules.
Expected output
Tests that match the specification and expose all 9 planted bugs.
Function under test
isLocked(failedAttempts, minutesSinceLast) → result
failedAttemptsa number (failed sign-ins in a row)minutesSinceLasta number (minutes since the last failure)
How your tests are checked
- ○Every expected value agrees with the specification
- ○Your tests expose all 9 planted bugs
The correct implementation is the oracle. A bug counts as caught when one of your valid tests gives a different result on the buggy copy than on the correct code.
testsMutation-tested in your browser
| # | failedAttemptsnumberfailed sign-ins in a row | minutesSinceLastnumberminutes since the last failure | expected result | Remove |
|---|---|---|---|---|
| 1 |
1 test
Ctrl/⌘ + Enter to check tests · your tests are saved in this browser
Results
Check your tests to see which planted bugs they catch.