Importance and Benefit of TDD in Development

Grace Angelica
MeetU Engineering
Published in
3 min readApr 17, 2018

Don’t you agree TDD is such a painful in the ass? Should you do it anyway?

While developing a project, developer are only have so little time to make sure all their code is working, the developer are always racing against time. Why bother write TDD, if you don’t have enough time?

Apparently studies has proven, with TDD the amount of time used to Quality Assurance Testing and Debugging is decreased.

Case studies were conducted with three development teams at Microsoft and one at IBM that adopted TDD. The results of the case studies indicated that the pre-release defect density of the four products decreased between 40% and 90% relative to similar projects that did not use the TDD practice.

Subjectively, the teams experienced a 15–35% increase in initial development time after adopting TDD.

That 40–90% decrease in pre-release defects means that QA teams and customers weren’t finding and reporting those issues. Engineering wasn’t trying to recreate bugs and develop patches, all of which have associated costs.

How come? What make TDD is such important?

  1. Help to prevent bugs

Preventing bugs is not a TDD goal. It’s more like a side effect.

  • TDD ensure comprehensive test coverage of the codebase, so bugs are less likely to pop up unnoticed
  • TDD make the product constantly maintained, so its quality guaranteed

2. The code can explain it self

Refactoring step in TDD make much cleaner codebase.

3. Avoid the fuss between developer and tester

It becomes really important to strategize the testing plan before starting to build the project, since that helps in clearly defining the roles and responsibilities of developers with respect to testers when it comes to testing.

4. Troubles can be seen so obviously

The benefit of a comprehensive test suite is that it alerts you to changes early, if someone makes a mistake and something doesn’t work the way it was supposed to, it will be obvious.

5. Save Money

When following TDD, developers can make changes with confidence and your QA team will catch fewer regressions. In development speak, “time saved is equal to money earned.”

6. No scope creep anymore

The nightmare of any project manager is scope creep — any unexpected growth in the scope of work which leads to delays in project delivery and TDD is the solution for the nightmare.

So yeah that’s the importance of using TDD ok I will do it, but it can be applied later after I finished the codebase, right?

Nahh! If you understand the benefits of creating test, you will regret you have done such a thing.

  1. You can rest safely knowing you haven’t missed any work

Why? of course because you already put the list of acceptance criteria on the test!

2. More productive

You’ll be more productive while developing, and TDD helps keep that productivity high by narrowing your focus.

3. Why bother worrying about dependencies, if you can mock ’em all

When writing tests, you’ll be able to mock any dependencies without really worrying about what they are doing behind the scenes. Plus, the dependencies you mock would potentially be faster when running the tests, and not bring additional dependencies to your test suite, in the form of filesystems, networks, databases etc.

4. Living documentations

Tests can serve as documentation to a developer. If you’re unsure of how a class or library works, go and have a read through the tests.

5. No more fear to refactoring the code

Once you’ve got a test passing, it’s then safe to refactor it, secure in the knowledge that the test cases will have your back.

So that’s all, thank your for visiting this blog!

--

--