MPLAB® Code Coverage Overview
The MPLAB® Code Coverage feature provides visibility as to what portions of your code are being executed. Run your test cases to completion for a visual display of coverage.
The MPLAB Code Coverage feature requires the following tools:
- An MPLAB XC C compiler (either Free or PRO) that supports code coverage output, starting with MPLAB XC8 v2.10, MPLAB XC16 v1.40, and MPLAB XC32 v2.30.
- The MPLAB Code Coverage (SW006026-COV) license that provides visibility as to what portions of your code are being executed.
- MPLAB X IDE v5.25 or later, which supports the display of code coverage data from an MPLAB XC C compiler with the MPLAB Code Coverage license.
Code coverage is displayed in the MPLAB X IDE as:
- Editor text highlighted by colors representing coverage:
- green = executed
- yellow = partially executed
- red = not executed
- Program memory highlighted by colors representing coverage.
- A Code Coverage tab with a report displaying color percentages of code covered. This information may be written to an HTML report for later viewing.
Figure 1: Code Coverage - Editor Window and Code Coverage Tab
Figure 2: Code Coverage - Program Memory Window
Documentation
Find MPLAB Code Coverage documentation at:
- MPLAB Code Coverage product page - Click on the Documents & Software tab.
- Online Technical Documentation - Search for "MPLAB Code Coverage".