Reputation: 13
I am a bit confused with the various types of code coverage: statement coverage, branch coverage, p-uses coverage, c-uses coverage, statement coverage, line coverage..... I am i interested in the basic unit test coverage done at the TDD level. What category of the aforementioned types of code coverage does this fall under? Thanks
Upvotes: 1
Views: 164
Reputation: 4391
The practical answer is TDD aims for statement coverage. If TDD is rigorously followed, statement, branch, line, and exception coverage should all be addressed.
In reality, not everyone practices TDD at that high level. Many teams choose to exclude test coverage for simple getters and setters, for example, considering them a waste of time and additional technical burden.
TDD uses refactoring and test complexity as factors to induce the developer to keep method sizes small. Following good practices involving variable scope and ownership, such as RAII which keeps new and delete paired in the same scope, should keep c-uses all scoped within the same test (although this discipline can break down in reference-counted memory allocation systems.) In order to really cover those scenarios, your team should be designing behavioral or functional tests to properly exercise the logic.
Upvotes: 2