Test Driven Development has become one of the most important and known paradigms in software development. We could say that is part of the Agile methodologies that are changing the traditional Waterfall way of work. But, what exactly TDD is?
If we summarize in a few words, we could say that TDD is just write first the test, and then write the code. That’s it. At the beginning it might seem a bit strange and you have to change the way you think when you are about to write a routine or a new class, but it has a lot of benefits that worth it:
- Ensures quality from the start. If you have any bug, the test will fail at first attempt.
- Maintains clean your modules of unused code.
- Provides regression testing. If you change a piece of code, you can be sure that it will not affect to any other functionality.
- Produces simpler and more focused APIs, classes and libraries. When you are developing a method that has to pass a specific test, you avoid the temptation of mess up your method with a different functionality.
- It’s much easier to match the code and business requirements.
There are a lot of different frameworks to implement Unit Testing and start to practice with TDD. Here you can find a huge list.
In this series of post for C++ language, I’m going to focus on the Google C++ Testing Framework. It’s been developed by Google and I find it quite simple and useful. In the next post we will explain how to use it and in subsequent posts I’ll try to explain other frameworks for .NET.