Checking the Code Coverage Report

Has code coverage been improved by running the unit test?

To analyze code coverage:

  1. Select the Code Coverage tab.

  2. In the Report Window on the left-hand side of the screen, open the UmtsCode.c node and then select the code_int node.

  3. If necessary, scroll through the Code Coverage viewer Source window until the second while statement is visible.

  4. Left-click this second while statement. You should see:

Code coverage has been improved somewhat, but the while statement has yet to be executed 0 times. To do this, you will have to create a new test. It would be preferable to do as little work as possible to create this new test. What other tests have forced the while statement to execute?

  1. Select the menu item Coverage->Test by Test

  2. With the mouse anywhere within the Source window of the Code Coverage viewer, right-click-hold and select CrossRef

  3. Click any part of the line

 while (x!=0)


Perhaps not surprisingly, the two code_int tests covered this while statement. All you need to do is copy one of the two tests but make sure x equals 0 (i.e. when x is equal to 0, you will be achieving the highest level of coverage on this while statement).