TDD and unit test, are both the same thing and have the same purpose?

Always when I read about TDD (Test Driven Development) it is related to unit test, it makes me believe that TDD is the same as unit test, and I do not know if this my definition is correct in relation to my point of view. Maybe I'm confusing the terms and mixing up the concepts.

Are TDD and unit test distinct things? If so, what are the differences between they and what is the purpose of each in particular?

Author: gato, 2016-05-25

1 answers

Are distinct concepts. TDD is a software development philosophy: to implement any functionality (or make changes to the code), you:

  1. creates one(or more) test (s), which are likely to be Unit, but not always
  2. runs the test, noting that it will fail (it is possible that in addition to the test, you will also need to implement something like mocks for the build to work)
  3. implements the functionality / change in the programme
  4. runs the test again, verifies that it is now passing.

Unit tests are just one component of TDD (Step 1 of the above process) - in every TDD process, you will have (many) unit tests, but not only them: integration tests, with or without mocks, are also required.

And you can use unit tests even without TDD. If you do not believe in this philosophy (and many do not follow it to the letter), then you can develop the software in the "traditional" way, and post-fact implement the tests (unit or not).

 8
Author: carlosfigueira, 2016-05-25 22:19:01