...which is more valuable to producing
robust code, testing or static analysis and proofs? ...
The main argument in favor of static analysis (including type checking) is that the results hold for all possible runs of the program, whereas passing unit tests only guarantee that the tested components hold specifically for the inputs they were tested with (on the platform they were tested on)...The main argument in favor of unit testing is that it is much more tractable. You can test many constraints of a program that are far beyond the reach of contemporary static-analysis tools...
Each tool has a major strength that can be particularly useful to complement the other tool:
Unit tests are able to show the common paths of execution, to show how a program behaves.
Analysis tools are able to check the coverage that unit tests provide.
The commercial
Clover
"is a code coverage tool for Java. It discovers sections of
code that are not being executed. This is used to determine where
tests are not adequately exercising the code."
(example:
Unit Test coverage report for the Xerces XML parser)
JUnitDoclet and
JUnit test case Builder are similar open source tools
still in alpha.
Daikon
infers program invariants from unit tests.
(Diagnosing Java code: Unit tests and automated code analysis working together ,
Eric E. Allen)
Posted to Software-Eng by jon fernquest on 10/19/02; 3:16:49 AM
|
|