Viewing code coverage helps you detect pieces of your source code that are not affected by simulation.

To view code coverage results
  1. Do one of the following:
    • Run the desired class with coverage, select suite to show, and open class in the editor.
    • On the main menu, choose Analyze | Show Code Coverage Data .
    • Press ⌥⌘F6 or ⌥⌘F6⌥⌘F6 or ⌥⌘F6⌥⌘F6 or ⌥⌘F6^ ⌥ F6, ⌃⌥F6 or ⌃⌥F6^ ⌥ F6, ⌃⌥F6 or ⌃⌥F6.
  2. View coverage results:
  3. Open in the editor the files you want to explore.
  4. Use the color indicators in the left gutter to detect the uncovered lines of code.

    viewHits_3.png

  5. To find out how many times a line has been hit, click the line in the gutter area.

    viewHits

    The pop-up window that opens shows the statistic for the line at caret. For lines with conditions, the pop-up window also provides statistic on the number of true and false hits.

    Use the following toolbar buttons:

    • arrowUp arrowDown: jump to the next/previous groups of covered or uncovered lines.
    • junitIcon: view JUnit tests that cover the line at caret.

      The test that covers the line at caret, is shown in a pop-up window:

      codeCoverage_popup
    • show-byte-code: show byte code of the current class in a pop-up window:

      byte-code

      • This button is only available, when Byte Code Viewer plugin that comes bundled with the product, is enabled.
      • When pinned, this pop-up window converts into the Byte Code Viewer.
    • settingsCoverage: open the General page of the Colors and Fonts settings, with the line Full line coverage highlighted.
    • close.png: hide coverage information.
  6. Create missing tests, as described in the section Creating Tests.