Getting started

 

With PureCoverage, you can ensure that all of your code is exercised in a few easy steps: 

  1. Run a program with PureCoverage. 
  2. Get the big picture with the Coverage Browser and Function List windows. Use PureCoverage filters to focus on the areas that concern you most. 
  3. Identify unexercised lines in the Annotated Source window. 
  4. Modify your test run to cover missed lines, conditions, functions, procedures, or methods. 
  5. Rerun the program to verify that you've improved coverage. Save coverage data to share information with other team members. 
This chapter describes how to use PureCoverage as a standalone application; however, you can also:  Note: You can use PureCoverage with programs built either in release or in debug mode. If you need detailed line-by-line coverage data, however, you must provide debug line information. For specific instructions, look up debug data in the PureCoverage online Help index. 

Running a program  

To start PureCoverage, double-click  and then click Run in the PureCoverage Welcome Screen to display the Run Program dialog. 

 
click to enlarge 

Java programmers: Click the Program name browse button and select your class or HTML file. PureCoverage automatically inserts the correct information in the Run Program dialog. For complete instructions, including the additional options that are available to you, look up java in the PureCoverage online Help index. 

Visual Basic programmers: Specify the native-code program (compiled using Visual Basic 5.0 or later) you want to test. For a p-code program (compiled using Visual Basic 6.0), type Cstart.exe as the program name and specify the p-code program you want to test in Command-line arguments. For complete instructions, including the additional options that are available to you, look up visual basic in the PureCoverage online Help index. 

For Visual C++ and Visual Basic native-code programs, PureCoverage first copies the program and each component it calls, then instruments the copies using Object Code Insertion (OCI) technology. The instrumentation process inserts additional code that permits PureCoverage to identify the parts of your program that are executed during a run. For Visual Basic 6.0 projects and p-code programs, and for Java code, PureCoverage doesn't instrument the code, but instead uses Cstart.exe to monitor procedures or methods directly. 

 
click to enlarge 

PureCoverage caches all instrumented components. When you rerun a program, PureCoverage saves time by using the cached files, reinstrumenting only the ones that have changed since the previous run. 

Getting the big picture  

The Coverage Browser and Function List windows show you the overall coverage status of your program at a glance: 

  • Every function, procedure, or method that has not been called is reported as missed. Those that have been called at least once are reported as hit. 
  • The number of lines of code missed and hit is also reported, if debug line information was available to PureCoverage. 
Visual Basic programmers: For the most detailed coverage data, monitor your Visual Basic 6.0 project directly from within Visual Basic 6.0, using the PureCoverage integration. For more information, look up visual basic, monitoring projects in the PureCoverage online Help index. 

With this information, you can easily identify testing hot spots - major areas that your tests have not covered. 

The Coverage Browser window provides coverage data organized hierarchically according to source file. 
 
click to enlarge 

The Function List window provides a textual, non-hierarchical view of the same data. You can do full-program sorts in the Function List window to find the least tested components in your entire program. 
 
click to enlarge 

More information? To learn how to customize the data display, look up coverage browser window and function list window in the PureCoverage online Help index. 

Focusing coverage data with filters  

PureCoverage collects coverage information for every module in your program, but, by default, does not display all the data it collects. In order to highlight the coverage information that you are most likely to find interesting, PureCoverage applies a default filter set to hide the data for certain system and third-party components of your program. 

To see the data that PureCoverage has filtered out, or to change the filtering to display other information that concerns you, click the Filter Manager tool    to open the Filter Manager dialog. 
 
click to enlarge 
 

More information? Look up filters in the PureCoverage online Help index. 

Identifying unexercised lines  

PureCoverage displays line-by-line coverage data as annotations in a copy of your source file. Double-click a function, procedure, or method in the Coverage Browser or Function List window to display the code in the Annotated Source window. 
 
click to enlarge 
 
By default, PureCoverage displays untested lines in red, tested lines in blue, and dead lines (typically in functions, procedures, or methods for which no active call is present in the code) in black. PureCoverage displays partially tested multi-block lines in pink. These lines often occur in conditional expressions for which you haven't tested the entire range of possible values. 

You can ensure that multi-block lines are fully tested by using the QuickWatch dialog in Developer Studio or by using an Immediate window in Visual Basic. With the program running, type in the name of the partially tested function or procedure and supply the parameter values you still need to test. 

More information? Look up annotated source window and colors, using in the PureCoverage online Help index. For help with the QuickWatch dialog or the Immediate window, see your Developer Studio or Visual Basic documentation. 

Modifying your test run  

Now you know what sections of code you missed when you exercised the program. If you're running the program informally, consider how you can exercise the code that you missed previously. If you're working with a test suite, you can add or adjust test scripts to improve coverage. 

In either case, with the information PureCoverage provides, you're working with your eyes open. You know what parts of your code need to be covered - no guesswork. 

Rerunning your program 
 
Now test again, and check your results. Check not only the coverage data for the new run, but also the Auto Merge data. The Auto Merge data is a composite of the coverage data from the new run and any available previous runs of the program. 
 
click to enlarge 
 
You can also merge data for specific runs manually. 

More information? Look up merging runs in the PureCoverage online Help index. For information about merging data from a series of tests automatically, read "Integrating PureCoverage in your test environment." 

Saving coverage data 

PureCoverage saves you time during testing by making it easy to share information with other team members. To save data, and share information, click the Save Copy As tool    to save data. 

PureCoverage supports two data formats: 

  • PureCoverage data files (.cfy), which you can open later in PureCoverage to analyze or to compare to future program runs. Or you can share .cfy files for use by other team members who are using PureCoverage. 
  • ASCII text files (.txt), for use in spreadsheet and word-processing programs. You can also communicate testing status effectively by including .txt files in email messages or bug reports. 
You can also save data from the command line, which is essential if you're running PureCoverage without the interface for your nightly tests. 

More information? Look up saving data in the PureCoverage online Help index. 
Back | Next | Table of contents



Copyright © 1999 by Rational Software Corporation. All rights reserved.