What is it and what is TDD for? [duplicate]

1

I was looking at PHPUnit - which is a unit testing framework.

Taking a look at some tutorials, I came across a term called TDD .

What is TDD ? And what is his use in the day-to-day programming?

    
asked by anonymous 24.02.2016 / 19:47

2 answers

2

TDD stands for Test Driven Development, it is a methodology in which test codes are written first even before any 'production code' exists, this includes defining a class or method.

Over the years it has been realized that the tests were neglected were left only at the end of the development cycle, which caused injury and much rework, the idea of TDD is that your code fails as quickly as possible because it is easier of correcting and its cost is low.

    
24.02.2016 / 19:52
2

TDD comes from "Test Driven Development" which in Portuguese means "Development Guided by Tests".

It requires the creation of an automatic test, before making the code, so when it is ready, you make sure it works.

Some benefits of developing with the methodology:

  • Developers are forced to understand the need before they start programming.
  • A large number of tests helps ensure that all code works well in the end.

The opposite argument is development time and cost since you would have to do the tests. Anyway this part is controversial because it is not so easy to prove both sides and TDD advocates say that the total development time ends up being less.

    
24.02.2016 / 19:55