Cycle, Rinse, Repeat


OK, here is test number two. This is just like test number one, except now we want to enter two numbers in our calculator, and ensure that the second number is the one that would show up on our display.

First step is to write a failing test.


OK, good. We’ve got our failing test. Now we just need to make it pass. Which we can by instead returning the last element added to our array and not the first. Like this.


Now we are ready ...

Get The Way of the Web Tester now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.