Friday, March 29, 2013

Why Test Driven Development is cool!

Test Driven Development (TDD) is cool! And useful. By writing tests for a method or class before implementing that class, work on that class is not finished, until all defined tests pass. Provided of course, that you wrote good and extensive tests, that cover as much as possible all the different cases and possibilities of how the method/class should behave.
And the upside is, that you can be sure that all your methods/classes keeps working later in the development process, because you have tests that continuously check if all classes keep behaving like you expect them to. If you would change something that would break the expected functionality of a method/class, then at least you will know, because some tests will fail. That's a few bug reports avoided!