Wednesday, October 2, 2013

UNIT TEST DEVELOPMENT OR TEST DRIVEN DEVELOPMENT TDD

When writing a unit test, you’re often looking for the smallest piece of functionality that you can
reasonably test. In an object-oriented language like C#, this usually means nothing larger than a
class, and in most cases, you’re testing a single method of a class. The use of testing small pieces of
code is that it allows you to quickly write simple tests. The tests need to be easy to understand so
that you can verify that you’re accurately testing what you intend to.
Source code is read far more often than it is written; this is especially important in unit tests, which
attempt to codify the expected rules and behaviors of the software. When a unit test fails, the developer
should be able to very quickly read the test to understand what has failed and why, so he or she
can better understand how to fi x what’s broken. Testing small pieces of code with small tests greatly
enhances this critical comprehensibility.