Unit Testing Best Practices

Posted on Jun 6 2009 - 7:40am by Raj

Unit Testing Best Practices
In software development projects, unit testing is a software validation type where the coder verifies each units of source code versus its specification. A unit is nothing but a most atomic testable part of a developed application program. In procedural computer programing single program, function, procedure, etc. can be considered as unit. In object-oriented computer programing, the smallest unit is a method, that may lie in to a base/super class, abstract class or derived/child class.
Here are a few Best Practices:
1. The print out of a unit should reside on a single sheet of paper.
2. If there are more than 4 levels of nested unit, then maybe it should be split in two.
3. Whenever the cyclomatic complexness of a unit is greater than 10 then it’s getting excessively complex.
4. Whenever it is content-coupled with another unit then it Is not a good unit.
The process is:
1. Prepare a test Plan of the unit tests.
2. Design the tests, the test environment, and operator instructions.
3. Identify and get the test data.
4. Code and run the tests.
5. Analyse the results.

About the Author

Leave A Response