Pages

Thursday, September 20, 2012

Test Driven Development(TDD) and Unit Tests

The idea of TDD is to focus on the requirements and the design first before go into implementation detail.

Unit tests are written to test a small piece of code in isolation.

When we write unit tests in TDD, we need to write the tests before doing the development, rather than writing the code and the writing unit tests like in traditional development.

First, all the unit tests should fail as implementation is not available. Once the implementation is done, we execute the tests again and then all the tests should pass.

This encourages the incremental/ evolutionary design by providing automatic regression testing for the design of the API.

No comments:

Post a Comment