Making It Pass

So, now that we have our solid failing Cucumber scenario in place, it’s time to let that scenario drive out a solution.

There is a very simple solution that will make the test pass, but it’s not going to get us very far. Let’s try it anyway, for fun:

 print ​"4"

Try it. You should see the scenario pass at last:

 ...
 
 1 scenario (1 passed)
 3 steps (3 passed)
 0m0.356s

Hooray! So, what’s wrong with this solution? After all, we already said that we want to do the minimum work that the tests will let us get away with, right?

Actually, that’s not quite what we said. We said we want to do the minimum useful work that the tests will let us get away with. What we’ve done here might have made the test ...

Get The Cucumber Book, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.