And finally, here you have the code coverage analysis report. The code coverage feature exposes the code coverage achieved either through manual interaction with the application of interest or via automated testing.
To view the Code Coverage report:
Select the Code Coverage tab.
On the left hand side of the screen, in the Report Window, you see a reference to Root and then to all of the source and header files of the UMTS base station. Root is a global reference - that is, to overall coverage. For each individual source and header file, a small icon to the left indicates the level of coverage (green means covered, red means not covered).
In the Code Coverage viewer, on the Source tab, a graphical summary of total coverage is presented in a bar chart - that is, information related to Root. Five levels of code coverage are accessible when the source code is C++, and those five levels are represented here. (Four more levels of coverage are accessible when working with the C language - up to and including Multiple Conditions/Modified Conditions. These levels are required by stringent certification standards such as aviation's DO-178B.) Notice how, on the toolbar, there is a reference to these five possible coverage levels ().
Deselect Loops Code Coverage ()
Notice how the bar chart is updated.
Reselect Loops Code Coverage ()
In the Report Window to the left, select the PhoneNumber.cpp node.
The Source tab now displays the source code located in the file PhoneNumber.cpp. This code is colored to reflect the level of coverage achieved. Green means the code was covered, red means the code was not covered.
In the Report Window, expand the PhoneNumber.cpp node and then select the void PhoneNumber::clearNumber() child node
The clearNumber() function should now be visible on the Source tab. Notice how its for instruction is colored orange and sitting on a dotted underline. This is because the for statement was only partially covered.
Click on the orange for keyword in the clearNumber() function
As you can see, the for loop was only executed multiple times, not once or zero times. Why should you care? Well some certification agencies require that all three cases be covered for a for statement to be considered covered. If you don't care about this level of coverage, just deselect Loops Code Coverage:
On the toolbar, deselect Loops Code Coverage ().
Now the for loop is green. If you would like to add a comment to your code indicating how this loop is not covered by typical use of the mobile phone simulator, have a look at the code by right-clicking the for statement and selecting Edit Source.
Select the Rates tab in the Code Coverage viewer
The Rates tab is used to display the various coverage levels for
the entire application
each source file
Click various nodes in the Report Window in order to browse the Rates tab. Note how a selection of the Root node gives you a summary of the entire application.
From the File menu, select Save Project.