Tool Mentors > Rational PureCoverage Tool Mentors > Evaluating Code Coverage Using Rational PureCoverage and Rational PurifyPlus (Windows)

Purpose

This tool mentor provides an overview of how to use Rational PureCoverage® to quickly and easily identify the gaps in your testing of Visual C/C++, Visual Basic, and Java applications, and Visual Studio.Net managed applications. This tool mentor is applicable for use with systems running Microsoft Windows.

PurifyPlus is a Rational product that includes PureCoverage functionality.

Note that you can also use Rational Purify to identify gaps in test coverage while you run your program to find memory leaks and errors; read the information about coverage data in the Purify Tool Mentor

To learn more about PureCoverage, including how to merge and compare runs, focus on coverage for specific parts of your program, and fine-tune data collection, read the Getting Started manual for the PurifyPlus product family (Windows version). 

For step-by-step information about using PureCoverage, see the PureCoverage online Help.

Related Rational Unified Process information:

Overview

PureCoverage monitors your program as it runs and reports exactly what parts of your program have and have not been exercised. You can use PureCoverage on whatever scale you want: you can collect data from informal tests of specific program functionalities, or combine data from all the runs controlled by your test suite. Used with Purify, PureCoverage can tell you what parts of your program have not been checked for memory errors and leaks, which helps you significantly improve the quality of the code you ship to customers. 

Tool Steps

To improve the effectiveness of your testing coverage:

    1. Run a program using PureCoverage to collect coverage data
    2. Use PureCoverage tools to analyze the coverage data
    3. Use your analysis to retest your program more thoroughly

1. Run a program using PureCoverage to collect coverage data 

The first step in improving coverage is to collect the coverage data for a run of your program.

You can do this by starting PureCoverage from your desktop, clicking the Run button on the Welcome screen, and specifying and running your program in the Run Program dialog. You can also run a program under PureCoverage from within Microsoft Visual Studio or Microsoft Visual Basic; first select the menu item PureCoverage > Engage PureCoverage Integration, then run your program as usual.

As you exercise your code, PureCoverage keeps track of which lines and which functions, procedures, or methods (collectively referred to here as functions) have been exercised, and displays a current coverage summary so that you can gauge the progress of your testing.

You can pause and resume data recording at any time, and so check specific portions of code. You can also take a snapshot of the current coverage data, which enables you to examine code coverage in stages.

When you exit your program, PureCoverage displays the coverage data it has collected. Because the dataset can be very large, PureCoverage applies default filters to hide non-critical data about system libraries and other modules before it displays the program's coverage details. As you analyze the coverage data, you can choose to display more or less data.

Tip: You can also use PureCoverage's command line interface to incorporate PureCoverage into your test scripts for automated testing. For instructions, look up scripts in the PureCoverage online Help index. 

For more information, look up the following topics in the PureCoverage online Help index:

  • running  programs

  • coverage levels

  • run summary

  • snapshots

  • filters

2. Use PureCoverage tools to analyze the coverage data 

The second step in improving coverage is to analyze the code coverage data that you have collected.

When you exit the program for which PureCoverage has been collecting data, the Coverage Browser window displays information such as the number of functions and lines hit and missed by your tests. In addition, you can see the percentage of functions and lines hit, and the number of times each function was called.

You can use PureCoverage's other windows to further examine the program's code coverage. To review coverage data for all functions in the current run, and to sort them by various criteria, use the Function List window. If debug line information is available, and you monitored functions at line level, you can use the Annotated Source window to analyze a specific function's coverage line by line.

PureCoverage provides several ways to display only the data you're interested in. For example, you can filter out data on the basis of module name, source file name, or function name. You can also use the Show/Hide Columns dialog to display only the type of information you are currently interested in.

By default, PureCoverage creates an Auto Merge entry in the Navigator window so you can easily analyze the total coverage of the program over multiple runs. You can also merge specific runs yourself.

For more information, look up the following topics in the PureCoverage online Help index:

  • coverage browser window

  • function list window

  • annotated source window

  • filters

  • merging runs

  • debug data 

3. Use your analysis to retest  your program more thoroughly 

The third and final step in improving coverage is to use your coverage analysis to modify your tests so that they exercise previously untested lines and functions, and then to use PureCoverage to verify the improvements. 

Using the modified tests, rerun your program under PureCoverage. Then click the PureCoverage Diff tool to compare the new results to the baseline dataset you collected for your initial analysis.

Use the Navigator window to keep track of all the runs you're working with. You can save coverage data as a PureCoverage data file (.cfy) to use for further analysis or to share with other PureCoverage users. You can save data to a tab-delimited ASCII text file (.txt) to use outside of PureCoverage; for example, in test scripts or in Microsoft Excel. You can also copy data from the Coverage Browser window to use in a text editor or from the Function List window to perform further analysis in Microsoft Excel.

To track your code coverage from release to release, archive your saved .cfy files with your product releases.

Tip: If you have incorporated PureCoverage into your test scripts, you can automatically save coverage data to a text file (.txt).  

For more information, look up the following topics in the PureCoverage online Help index:

  • scripts
  • navigator window 
  • saving data 

Copyright  © 1987 - 2001 Rational Software Corporation


Display Rational Unified Process using frames

Rational Unified Process