Elevator controls are deceptively simple. Normally you just get in, poke a button, and off you go.
But, how often do you think about how they work? How are they tested? How would you test it?
There is a control both inside and outside an elevator.
The outside control calls an elevator depending on what direction a rider wants to go–if you want to go up for example, the elevator that’s already going up should be the one to stop.
The inside controller has more complexity. There are:
- buttons for floors,
- buttons to open and close the doors,
- a phone to call for help if you get stuck,
- a bell button that you can actually push whenever you want, even if you’re not stuck, which is fun,
- a floor indicator
Using this information, and what you already know about elevators, what are the test cases you can think of? What edge cases might there be?
Here are a couple to get things started:
- What happens if someone calls the elevator while it’s already moving?
- What happens if someone summons the elevator to go UP, but they ask the elevator to go DOWN a floor instead?