These are different concepts. TDD is a software development philosophy: to implement any functionality (or make changes to code), you:
- Creates a (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 implement something like mocks for the compilation to work)
- Implements functionality / change in program
- Run the test again, check that it is now passing.
Unit tests are just one component of the 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 needed.
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).
Possible duplicate of Tests, TDD, Unit Test, QA and similar. What is the difference between concepts on tests?
– Maniero
@Bigown I read the answer of this your question, are so many test concepts that confused me even more, so I decided to also ask a question more directed to TDD and Unit Test where is the point that causes me more confusion, because both are similar. I don’t think it’s duplicate, but it’s at the community’s discretion.
– gato