1.

What is Test-Driven-Development?

Answer»

Test-Driven-DEVELOPMENT (TDD) is a popular software development technique, first introduced by Kent Beck in his book with the same name, published in 1999.

In TDD, a developer working on a feature first writes a failing test, then writes just enough code to make that test pass. Once they have a passing test, they add another failing test and then write just enough code to pass the failing test. This cycle repeats until the developer has the fully working feature. If the code under the test has external dependencies such as database, files, or network, you can MOCK them to isolate the code. 

Benefits of TDD:

  • Writing tests first forces you to think about the feature you are trying to build, helping you produce better code. 
  • As you always have a working set of tests at hand, a failing test indicates that the problem is with the code you just added, reducing the time spent in debugging. 
  • Writing tests HELP the developer to clarify the requirements and specification. It’s challenging to write good tests for a poor set of requirements. 
  • It’s tough to produce high-quality software unless you can test the software after each new CHANGE. You can NEVER be sure that your new code didn’t break the working software. TDD gives you the confidence to add new code, as you already have a test in place.


Discussion

No Comment Found