Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What techniques have you actually used successfully to improve code coverage?

I regularly achieve 100% coverage of libraries using TDD, but not always, and there always seem to be parts of applications left over that are untested and uncovered.
Then there are the cases when you start with legacy code that has very few tests and very little coverage.

Please say what your situation is and what has worked that at least improved coverage.
I'm assuming that you are measuring coverage during unit testing, but say if you are using other techniques.

like image 674
quamrana Avatar asked Oct 04 '08 17:10

quamrana


People also ask

Which technique is used to measure code coverage?

Code Coverage Analysis is simply a structural testing technique to measure how many lines/blocks/arcs of your implemented code are executed while the automated tests are running. Its analysis gives you a quick, automated and accurate quality & coverage measurement for test plans.


1 Answers

Delete code.

This isn't snarky, but actually serious. Any time I would see the smallest amount of code duplication or even code that I couldn't get to execute, I deleted it. This increased coverage and increased maintainability.

I should note that this is more applicable to increasing the coverage of old code bases vs. new code bases.

like image 165
Frank Krueger Avatar answered Oct 11 '22 13:10

Frank Krueger