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 files of the UMTS base station. Root is a global reference - that is, to overall coverage. For each individual source 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 for Java, 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.) Notice how, on the toolbar, there is a reference to these five possible coverage levels (F, E, B, I and L toolbar buttons).
Deselect the L toolbar button to disable Loops Code Coverage.
Notice how the bar chart is updated.
Select Loops Code Coverage again by selecting the L button.
In the Report Window to the left, select the HardwareMonitor.java node.
The Source tab now displays the source code located in the file HardwareMonitor.java. This code is colored to reflect the level of coverage achieved. Green means the code was covered, red means the code was not covered.
Within the run() method you should see a while statement that is colored orange and sitting on a dotted underline. This is because the while statement was only partially covered.
Click on the orange while keyword in the run() method.
As you can see, the while 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 while loop to be considered covered. If you don't care about this level of coverage, just deselect Loops Code Coverage:
Deselect the L toolbar button to disable Loops Code Coverage.
Now the while 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, access the code by right-clicking the while 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
individual methods
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.
Select the menu item File->Save Project