Using PureCoverage in your Test Environment

Related Topics

Integrating PureCoverage with your test environment gives you a powerful tool for continuous coverage monitoring. For example, say you're running a series of automated tests on a native-compiled (unmanaged) Visual C++ program, each time using a different set of data. You can modify the script to merge the coverage data into a single file. To do this, add the following line to the beginning of your test script:

del <exename>_AutoMerge.cfy

to delete any existing Auto Merge data files. Then, each time you run your program, substitute the following for the run command:

coverage /SaveMergeData /SaveMergeTextData <exename>.exe

to run the program, merge the coverage data from all runs of the program, and save it to a PureCoverage data file (.cfy), <exename>_AutoMerge.cfy, and to an ASCII text file (.txt), <exename>_AutoMerge.txt.

Alternatively, say you're running a series of automated user-interface tests on the same Visual C++ program. You can quickly get coverage data on your automated user-interface tests by modifying the script to run the instrumented copy of the program and save coverage data. To do this, add the following line to the beginning of your test script:

coverage /Run=no /Replace <exename>.exe

to instrument the program without automatically running the instrumented program. PureCoverage renames the original program to <exename>.exe.original and replaces it with the instrumented version. To save the coverage data, specify the /SaveMergeData and /SaveMergeTextData options in <exename>_pure.ini. For details about .ini file names and their locations, click images\shortcut.gif.

If you incorporate PureCoverage into your nightly tests, you can make sure that new and modified routines are tested. Compare your coverage data from day to day. An unexpected drop in coverage probably indicates that your tests are not covering new material.

Notes:

§                  To run programs from the command line, you must have the Rational/common directory in your PATH environment variable.

§                  Options that relate to cache directories and instrumented files apply only to runs of native-compiled (unmanaged) programs.

§                  If you are using Microsoft Windows 2000 or higher, the Windows File Protection feature (WFP) may cause problems when you use PureCoverage's /replace command line option. For a workaround to this problem, click images\shortcut.gif.

(C) Copyright IBM Corporation 1993, 2010.