Using Code Coverage Analysis to Improve Code Coverage

You will now use the information gathered by the code coverage analysis feature to modify the manual test in such a way as to improve code coverage.

To improve coverage of your code:

  1. Select the Code Coverage tab.

  2. If necessary, select the Source tab of the Code Coverage viewer

  3. In the Report Window on the left-hand side of the screen, open the UmtsConnection.cpp node and then select the processMessages() child node

  4. Drag the slider bar down slightly until you see the line:

if (strcmp(msg->phoneNumber,"5550001")==0)


Notice how the if statement was never true - the else block is green, but the if block is red. In order to improve coverage of this if statement, you need to make the boolean expression evaluate to true.

According to this code, the if expression would evaluate to true if mobile phone sends the phone number 5550001. You should do that.

You will now rerun the UMTS base station executable, restart the mobile phone simulator, and dial this new phone number. When you have finished, you will check the memory profiling, performance profiling, and code coverage analysis reports to see if you have improved matters.