Testing theory
There are few popular ways of writing tests. Let's look at them and understand the difference between them.
Test-driven development
Test-driven development (TDD) is a process that relies on short repetition development cycles. It means that we write tests while we are writing an implementation. The shorter the cycles are, the better. Here is a diagram showing the TDD flow:
Before we write the actual code that does the job, we need to prepare a test. After the first run, the test fails, because there is nothing implemented. After that, we have to make the test pass cycle by cycle. When it happens, we may spend some time refactoring what is done so far and continue with the next method, class, or feature. Everything starts from writing tests. This is a very good approach, because that's the place where we define what our code should do. By writing tests, we protect ourselves from writing and delivering code that is not needed. We are also sure that the implementation meets the...