What is TDD and what is it for?

Asked

Viewed 421 times

1

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

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

What comes to be TDD? And what’s his use in day-to-day programming?

  • 2

    Not the same question as? http://answall.com/questions/53678/para-que-servem-testes-unit%C3%A1rios-e-quais-as-vantagens? Rq=1

  • 1

    @Diegof I believe not. TDD and Unit tests usually go together, however you can do TDD with other types of tests, aceptance tests for example. Also nothing prevents you from using unit tests without using the TDD methodology, I could for example do unit tests after implementing my functionality.

  • 5

    First time I ask to close any question of yours, take the wrong no... It would not be the same as Tests, TDD, Unit Test, QA and similar. What is the difference between concepts on tests? ???

  • Now I was in doubt, here seems a little more specific, but the utility seems to me something ample and that maybe this @utluiz said "The main idea is to reverse the "traditional" sequence of development by putting the test first, before implementation." I would, but I’m in doubt now :/

  • @Guilhermenascimento this question of duplicate is what confounded me: The question must be equal to be marked, or the answer answer to the question (which is not duplicated, but would lead to a duplicate answer)?

  • Both cases count as Wallace duplicate, but I just don’t know if the other answer explains the utility in the way you need to understand it. Anyway the advantages always seem to me of the need or of how a team works, so I think the need is case by case, I’m not sure if the answer there answers this and if I’m right :/

  • @Guilhermenascimento I think I understood yes. I’m just wondering if I mark or not ;)

  • Since only I voted, leave it open for now. We may even need a more specific answer, if it is possible to answer because of that use "case-by-case" question.

  • Today I looked better, the utluiz response is great and explains well the relation TDD and unit tests, but it doesn’t really seem to explain the "usefulness" in everyday life and I think this is your specific doubt. I will withdraw the closing vote :) good luck!

Show 4 more comments

2 answers

3


TDD stands for Test Driven Development, is a methodology in which test codes are written first even before there is any 'production code' that includes the definition of a class or method.

Over the years it was realized that the tests were neglected were left only at the end of the development cycle which generated poor judgment and much rework, the idea of the TDD is that its code fails as fast as possible because it is easier to correct and its cost is low.

  • I found it interesting the idea of TDD is that your code fails as fast as possible because this is easier to fix, you explained in a way that anyone can understand and with few words +1

  • 1

    @Guilhermenascimento thanks, I still want to edit to half time =, haha missed to make clear that the tests are automated, which serve as documentation in some situations, the TDD cycle, baby Stapes etc

  • ours seems to be wider than I thought, but it seems to me that answered well what the AP needed to know, the advantage of Day to Day ... gave me an idea for a question hehe, I’m on the cell, then I put :)

2

TDD comes from "Test Driven Development" which in English means "Test Driven Development".

Requires the creation of an automatic test, before making the code, for when it is ready, you make sure it works.

Some benefits of developing with the methodology:

  • Developers force themselves to understand the need before starting programming.
  • A large number of tests help ensure that all the code works well at the end.

The opposite argument is the development time and the cost, since it would have to do the tests. Anyway this part is controversial because it is not so easy to prove either side and who defends TDD says that the total development time turns out to be less.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.