| Article Index |
|---|
| Unit Testing: Why is it required? |
| Page 2 |
| Page 3 |
| All Pages |
The development team automate unit tests for many reasons. Some of the important ones are as follows:
* Unit tests help provide quick feedback to the developer.
* Unit tests help simplifying the structure of the system.
* Unit tests assist mitigating concerns about the effects of refactoring.
* Unit tests assist validating code integration.
* Unit tests often result in more testable code.
* Unit tests documents the code they test.
* Unit tests are typically inexpensive to run and maintain.
* Unit tests report serious problems early.
Early Feedback Mechanism
Feedback can be as simple as an error or as complex as having to refactor the code because it's just too difficult to develop a comprehensive test for it. An automated unit test provides feedback to the developer before other test systems exist for the code. This feedback is provided in the environment closest to the developer, making it less expensive to fix any errors found. As we all know, errors found by the developer who's writing the code are less expensive to fix than those found and recorded by a tester. The time needed to record, process, and track the error becomes overhead on the project.
Simplifying System Structure
A properly structured system is easy to unit test. A desirable unit test that's difficult to implement is seen as a sign that the system needs improving. As discussed earlier, this immediate feedback is valuable to the developer. Often, developing unit tests will help to focus and clarify thoughts on the code being developed, by forcing issues and ambiguities to the surface before implementation and release. In general, a simpler system is cheaper to maintain and allows developers new to the project to come up to speed more quickly.
Mitigating Refactoring Concerns
Unit tests are typically written at the time of the highest flux and least reliability in the code. By providing quick feedback and reducing system complexity, developers who use unit tests can work confidently during times of flux and make changes with confidence, knowing that any omissions or new errors introduced should be caught by their suite of unit tests. In my experience, developers who have a suite of unit tests for their code introduce fewer errors during project crunch times, when people are working long hours and requirements are changing daily. It's easy for the test team to identify those individuals who developed and maintained unit tests throughout the project.
| < Prev | Next > |
|---|