TDD — The importance of the tests in software development
A lot of programmers ignore the importance of testing your applications, sometimes, the tests are executed in the local host.
There are many companies that discourage to use of the TDD practice because they think that the development time will last longer, and for this reason, will increase more costs of the project. In principle, make sense, but in long-term the project there can be significant savings.
The fear of the production environment
We need to feel fear because fear helps protect us. Sometimes we feel fear to deliver a new feature in the production environment.
Many times that cause is not having sure if the software will work as expected. This is one of the reasons that should have automated tests in your application.
So, the TDD is a key to manage the fear during the programming.
Imagine a scenario in which you working to fix a bug. And after a while, you fixed the bug, but how would you know if this fix implementation broke another resource on your system? You have some possibilities
- Run UI tests, or manual tests, but if the program is too big, forget it, and there is the possibility of mistakes human these tests. For example, don’t test other functionality that can be impacted by the fix because don’t knowledge all system.
- Run the automated test, and you’ll have faster feedback if any flow from the system is broken. If the system is totally coverage with tests of course.
In an article created by Boby George and Lourie Williams with 6 group pairs of the programmers, in which 6 was TDD pair and 6 control pair in a total of 24 professional developers, they believe that
- 87.5% — TDD approach facilitates better requirements understanding
- 95.8% — Reduces debugging effort
- 50.0% — Felt that TDD led to less code development time
- 78.0% — Thought TDD improves overall productivity
For questions relating to the effectiveness
- 92.0% — Believed that TDD yields higher quality code
- 79.0% — Thought that TDD promotes simpler design
- 71.0% — Thought that approach was noticeably effective
- 80.0% — Thought that TDD is effective
But, adopting a TDD mindset was difficult, in the article was to 56% of the professional developers, for me either, but my tip is:
- You need to understand the product that you work
- You need to understand the functional requirements that you will implement
- You need to practice every day :)
Growing the company in a faster mode
The number of technical bugs can be reduced with TDD, and the Project Managers can estimate with more confidence. If the number of technical bugs is reduced, so the team has more time to work on new features, decreasing the development time invested to fix bugs and gaining more time to create new features, the application takes more quality, and evolution, as a result, increasing the billing company.
Then, what do you think is better: to invest in a developer team, that spends more time creating features or fixing bugs?
The fear of refactoring
The automated tests in an application and good test coverage, give us possibilities that refactor the code without fear into broken some features. Because the process of the refactor can change the behavior that some features, then an application with good test coverage, will give us fast feedback if this happens.
Boby George and Laurie Williams. 2003. An initial investigation of test driven development in industry. In Proceedings of the 2003 ACM symposium on Applied computing (SAC ‘03). Association for Computing Machinery, New York, NY, USA, 1135–1139. https://doi.org/10.1145/952532.952753