For this post, I looked for some info on code coverage. Garrett Levy’s article “The Importance of Code Coverage,” covers the types of code coverage and why they are important. It is a short read and it helped clear up some uncertainties I had.
The article starts off by explaining the reasons for code coverage. Put simply, code coverage calculates the behavior of test code and sees which lines and branches are tested. This is useful because testers can see where their test code is incomplete and missing test cases.
Levy then describes four types of coverage. First, statement coverage is the amount of code statements that were used during testing. Next, branch coverage is the number of branches caused by conditional statements that have been tested. Function coverage test which functions have been used during testing. And finally, line coverage tests which code lines have been used during testing. By using all four, a tester can easily see what cases are missing in the tests.
I found Garrett Levy’s article, “The Importance of Code Coverage,” to be a quick read that helped me get a clearer idea of code coverage.