13 benefits you will get by using Test Driven Development

by Guest Author on May 19, 2017

in Articles, Guest Posts

The first thing I do when a tech company says they are Agile, is ask about test driven development and continuous integration. If they don’t do it, in my opinion, they are just not Agile. Today I would like to focus on the benefits of TDD.

Over the years I have been listening to different opinions about TDD. People talking about it’s importance and about past experiences, working with a code that was not designed using Test Driven Development. After reading a lot and asking around, I have come to the conclusion that to be more productive at work, to be faster and to get less bugs, TDD is the way to go.

More about TDD & its 6 steps

TDD stands for Test Driven Development, which basically is a way of writing software in Agile teams. Basically, developers create some unit tests while they’re building their code. Those unit test are going to be testing a small piece of the software’s code, making sure that it works as supposed to. Before going through the amazing benefits of TDD, I think it’s important to have a quick idea of how it works.

  • Step 1 – For a new feature, start by writing an automated test about how the new functionality should behave.
  • Step 2 – Run the test and wait for it to fail, which ensures it works correctly.
  • Step 3 – Write a code or update the functional code for the test to pass. At this step, the only purpose is to pass.
  • Step 4 – Run the test and wait for it to pass. This implies that the new code meets the requirements.
  • Step 5 – Refactor your code & make you created a clean code.
  • Step 6 – Repeat

Some of the main benefits of TDD

1. Documentation you will appreciate later on. TDD can be seen as an effective way to communicate to other developers what was done and how the code is supposed to work. To know what the code does & to know more about its responsibilities, you can easily check it by looking at the tests. You can use is as an outline of what you had in mind during each step of the development process.

2. Peace of mind. By doing TDD you can very easily make changes to your app and don’t need to worry about breaking it.

3. The customer’s satisfaction is key. I don’t need to go over the importance of keeping the customer satisfied. Every time an iteration is done, it is mainly based on the quick feedback, this implies the client is getting what he really want. Let’s just say that TDD works.

4. A code that reads well & make sense. To write a test you will have to consider the public interface that will be integrated by other code in the system.

5. Refactoring made easy. As mentioned, we refactor once the test passes. Doing TDD ensures that once you change the code everything will work as before. It makes it easier to refactor because the practice yields a comprehensive set of unit tests, which will fail if any change has broken the code.

6. Always getting a quick feedback. An amazing aspect of TDD is that you get immediate feedback regarding the features developed / tested which enables you to fix the defects at a faster rate.

7. Debugging. TDD will definitely help you fix a bug or at least save time in fixing bugs. If a bug comes up, the first thing to do is to write a test that will help the bug not come back because it will have test coverage, and at the same time you will know more about what the bug is.

8. Don’t you want to avoid overdoing it? I am sure you faced a situation where you had to go through over-engineering because not all the pieces of the code where contributing to the requested functionality. Well TDD will definitely help you avoid such a situation, which takes us to the next benefit.

9. Get a clear vision. By identifying unnecessary code, you are able to get a clear vision of the required features and just get rid of all the useless components.

10. Work on it until it passes. Instead of having too many things to think about and to keep in mind, instead of thinking about all the functionalities, about the whole application, you stay focused on one functionality. You concentrate on smaller parts, you work on it until it passes.

11. Increase productivity & communication of your team. Aren’t those three aspects we all want to improve in our team? With TDD you will definitely improve communicating the problem that is being solved, as well as reducing the time spent on re-doing the work. Also, coming back to the 9th benefit, teams get better as they work together and keep their focus on one thing at a time.

12. Don’t omit scalability. The more your app grows in complexity, the more it costs and the more it will take time to be on the market. If you don’t do TDD, at a certain point it will become unfeasible to keep all the code.

13. You will love your code. You will definitely get a stronger code that has less bugs, that is easily maintainable, flexible & extensible.

Conclusion

I mentioned earlier that in my opinion, you can’t be Agile without doing TDD & continuous integration. Agile is all about regular iterations and adapting to change. Well, Test Driven Development helps teams to update their application without having to go through a lot. Tdd provides you with a higher quality, higher productivity and specially with more confidence.

Guest article written by: Lea Karam is a dedicated and motivated Marketing Project Manager working at Apiumhub, a software development company. Passionate about latest technologies & Agile project management in general, Lea regularly writes about topics concerning the tech & digital industry.

Related articles you might find interesting:

Comments & Leave a Comment

comments

{ 0 comments… add one now }

 

Leave a Comment

CommentLuv badge

Previous post:

Next post: