Re-read some unit testing tips
Followed up more on unit testing again today by turning to my trusted tome "Code Complete" [ Code Complete ] to read what it had to say on the topic of unit testing. Here are some interesting snippets taken from Chapter 25 (p.589):
- Unit testing is the testing of individual routines.
- Testing is not debugging. Testing is done to detect errors.
- To determine how many tests should be done for a given routine, use the following guide:
- Start with 1 for the straight path through the routine.
- Add 1 for each of the following keywords, or their equivalents: if, while, repeat, for, and, and or
- Add 1 for each case in a case statement. If the case statement doesn't have a default case, add one more.
- Industry average: Between 15 to 15 errors per 1000 lines of code.
- In the long run the best way to improve your testing process is to make it regular, measure it, and use what you learn to improve it.
Cya...
"Programs do not acquire bugs as people acquire germs, by hanging around other buggy programs. Programmers must insert them." - Harlan Mills