Friday, Feb 17 2017

Is Code Coverage Effective?

Written by

code coverage

 

When software developers need to measure the quality of their code, many turn to code coverage. The technique provides a metric regarding how much of the code is covered by the testing plan, giving definitive feedback regarding the thoroughness of applicable testing.  But how effective is code coverage, and does it actually help you create a better product?

Shorten Development Timetable

Professionals working in the software development field state benefits regarding the amount of time required to complete testing. Since code coverage serves as a tracking mechanism, less time is required to maintain the code. It also supports initiatives like agile and DevOps by creating a more efficient test plan and limiting technical debt.

 

Some development programs include code coverage within their product. For example, Microsoft Visual Studio provides internal tools for measuring code coverage. Additionally, third party solutions are available to test code based on a variety of languages. That means you do not have to dedicate internal resources to the creation of these solutions. However, manual methods are also available, though they can add time to the development cycle.

Clear Coverage Results

Code coverage allows developers to see exactly which code was tested and which code wasn’t. This helps confirm the portions that are working properly while guiding further testing to reach portions of the code that were not covered in prior testing.

 

Since the status of the testing is easily measured, this allows companies to set minimum thresholds before a release is scheduled. However, many businesses find it unnecessary to reach 100 percent coverage before considering release. Instead, a target of 80 percent or more may be sufficient. Then, if issues arise post-release, developers already understand which code was not previously tested, helping to speed up troubleshooting efforts.

Code Coverage Shortcomings

One area where code coverage is lacking is in the potential quality of the code. The system lacks the ability to determine whether the underlying tests were of a high enough quality to evaluate the product code properly.

 

Additionally, there is nothing to prevent developers from focusing on unit tests when higher code coverage targets were required. If a business puts extreme pressure on developers and focuses on particularly high code coverage requirements (such as 95 percent or higher, depending on the amount of source code involved), testers may not have the time required to create high-quality tests while also meeting the requirement.

 

Ultimately, code coverage cannot judge how meaningful a test may be, only what was tested. To ensure quality testing, additional policy may be required to guide efforts. Additionally, the tests may need to be reviewed to ensure best practices are being used.

 

This means that the results of code coverage will only be as useful as the code driving the test. Organizations will need to create standards regarding how the analysis will be performed to yield high-quality results.

 

If your company is interested in hiring new developers familiar with code coverage, The Armada Group has the skills required to find your ideal candidate. Contact us and see how our hiring solutions can work for you.