I’m new to using code coverage and not up on how they behave. The tools I have tried all seem to want to run the entire suite of unit tests to do their analysis. I had though that they would somehow analyze the code statically, that is, without having to run Unit Tests.
Is my assumption incorrect?
The usual open source tools, like Cobertura, Emma, etc., require running the tests. They use things like byte-code manipulation or AOP to instrument the code and track which lines get executed as the tests run, then produce reports of the results. The simplicity of it makes it a very attractive solution.
It’s really interesting that you can approximate test coverage with static analysis, but it seems like a last-ditch option for cases where running the tests is not practical. Quoting from the abstract from the paper quoted in Ira Baxter’s answer: