TDD and Unit Test, both are the same thing and have the same purpose?

7

When I read about TDD (Test Driven Development) it is related to Unit Test , this makes me believe that TDD is the same as Unit Test , and I do not know if this definition of mine is correct in my point of view. Maybe I'm confusing terms and blending concepts.

TDD and Unit testing are different things? If so, what are the differences between them and what is the purpose of each one in particular?

    
asked by anonymous 26.05.2016 / 00:04

1 answer

7

They are different concepts. TDD is a software development philosophy: To implement any functionality (or make changes to the code), you:

  • Create one (or more) test (s), which will probably be unitary, but not always
  • Run the test, noting that it will fail (you may also need to deploy something like mocks to make the build work)
  • Implements feature / change in program
  • Runs the test again, verifies that it is now passing.
  • Unit tests are just a 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), then you can develop the software in the "traditional" way, and post-facto implement the tests (unitary or not).

        
    26.05.2016 / 00:19