December 2019
Intermediate to advanced
248 pages
5h 34m
English
In many ways, our proctor is the biggest testing challenge in this book. We have a scheduler that depends on concepts of both mutability and time, ideas that are generally kryptonite for tests.
The scheduler has three events: schedule, start quiz, and stop quiz. Each of these ideas is important. Our tests could wait, using sleeps, as our quizzes cycle through their respective states, but that strategy would make our tests both fragile and slow.
Sleeps in tests are inherently bad. Wait too long and your tests are slow; don’t wait long enough and your tests won’t be consistent. To prevent race conditions and timing dependent code, we’ll need to find a better approach.
Here’s our plan, then. Let’s modify ...
Read now
Unlock full access