Introduction to TDD
In this section, we will introduce you to a popular and very useful unit testing technique, that is, the TDD approach. Here, we will discuss only TDD theory concepts. From the next section onward, we will write unit tests for all of our Scala Reactive programming applications, one by one.
What is TDD?
Test-Driven Development (TDD) means test first, code next. This means, with the TDD approach, we first write the unit test before writing any code. Then, we execute that unit test; it will definitely fail (RED) because we have not written any code.
Next, we write the code to match that unit test (test case) and execute that test again; this time, it will pass (GREEN). Next, we write one more test case (unit test) for the same component, then write the code, and so on. Finally, once we finish writing all test cases and code, we finish the development of that component.
We can illustrate this approach with a diagram:

TDD is a unit testing technique in Agile methodology. As we write...