Writing application code to fix the test – GREEN

Now we will write code in our application class to fix the test, that is, for it to go green. This will be done in baby steps, and we will only fix the issue the test complains about in each of the steps. This is where the term "test-driven" takes root. Our test is driving our implementation. At no point are we free to jump to conclusions.

Note

As you get better with your TDD, it is forgivable to jump a few steps. For appreciation and empathy with TDD, we will follow TDD in its purest form in this chapter.

From the error we got in our last run, that is, an implementation is missing, we can see that the test runner is complaining about a missing implementation of the function decimalToBinary.

To make ...

Get Scala Test-Driven Development 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.