Johnny Butler

April 22, 2021

Test Driven Development - Thoughts & Experiences

Using TDD and having a comprehensive test suite are the backbone of any software application. The earlier this is used/introduced the better for many reasons stated throughout the industry. As I have worked in several start-ups the responsibility of the application working/performing lands on my shoulders, so this is essential. With a good test suite in place and continuous integration practiced, there is confidence throughout the business that the application is working to expectation and can be changed quickly/reliably.  It also gives you the confidence to be aggressive while working within the existing code.

Some other benefits of using TDD and testing in general is that they act as a great documentation source which the inner workings of the system.  A good test suite can reveal all the moving parts in a particular area of the system, what are the expected inputs/outputs.  A great place for a new member of the development team to get started. 

One of the biggest advantages of TDD in my opinion which is often overlooked is while thinking/writing the tests I am actually understanding the problem more and figuring out the best approach without directly knowing.  Focusing on the single objective of one test is a stepping stone to the finish line.  I will sometimes delete tests that are useful during the iteration process but lack real value once the task is complete.  These tests may be a bit slow, may be covered by another similar test or just no longer serve a purpose anymore. The objective is to have nice clean code and adequate test coverage that prove it works.

I understand some start-ups develop from an idea and just grow, testing becomes an after thought. It's never too late to implement a test suite and its a good practice to learn the code, business logic and identify refactoring opportunities to improve code/performance/security. I have developed applications from scratch using TDD and inherited applications without any tests so have experience with both scenarios.