This topic explains how to increase code coverage using Coverage Advisor.
Introduction
C/C++test's Coverage Advisor is a solution that facilitates increasing code coverage for C and C++ projects. It provides guidance for covering gaps in code coverage by analyzing code and displaying available solutions of how to set up a test to cover an uncovered line. The information about required dependencies and pre-conditions is displayed in the Coverage Advisor view.
Computing Test Case Pre-conditions
Right-click a line in the editor and choose Parasoft> Show in Coverage Advisor from the context menu. The Coverage Advisor view will open automatically, providing information about available solutions to cover the selected line. If more than one solution is available, the least complex solutions are displayed first.
Each coverage solution includes the following information:
- Required dependencies - Dependencies that need to be customized to cover the selected line. These may include function parameters, external function calls, global variables, local variables, and class members.
- Pre-conditions - Conditions that must be satisfied by the required dependencies to cover the selected line. Clicking a pre-condition navigates to the related code line.
- Expected coverage - Code lines that will be covered if all of the pre-conditions are satisfied.
You can click the Clipboard button next to each solution to copy the solution data to clipboard.
Related Topics
- Adding User-defined Test Cases - Learn how to create test cases using Test Case Editor or Test Case Wizard. This will help you make practical use of the data computed by Coverage Advisor.
- Using Stub Callbacks - Learn how to configure test case-specific stub behavior. This will help you effectively increase code coverage.
- Reviewing Coverage Information - Learn how to review coverage information from tests run with C/C++test. This will help you analyze coverage data and understand which test cases are related to covered elements.