Tool Mentors > Rational TestFactory Tool Mentors > Measuring and Evaluating Code-based Test Coverage on Rational Robot Scripts Using Rational TestFactory

Purpose

This tool mentor describes how to use Rational TestFactory to measure and evaluate code-based test coverage for Rational Robot scripts that test an application written in C++, Java, or Visual Basic, or that test a Java applet.

Related Rational Unified Process™ information:

Overview

You can use Rational Robot to implement test procedures, and then execute the resulting test scripts. Code-base test coverage data is not available, however, when you execute the test scripts in Robot. Rational TestFactory has the capability of calculating code-based coverage metrics for Robot test scripts.

This tool mentor is applicable when running Windows 95/98/2000/NT 4.0.

To use Rational TestFactory to evaluate code-based test coverage for Rational Robot scripts:

  1. Record or program test scripts in Rational Robot
  2. Execute the Rational Robot scripts in Rational TestFactory
  3. Review code-based coverage data for each script

1.   Record or program test scripts in Rational Robot To top of page

To record or program test scripts in Rational Robot, see Tool Mentor: Creating Test Scripts Using Rational Robot.

Note: For Rational TestFactory to calculate code-based coverage data successfully for Rational Robot scripts, each script must start and stop the application-under-test (AUT).

Help icon   Refer to the Viewing code coverage for a Robot script topic in Rational TestFactory online Help.

2.   Execute the Rational Robot scripts in Rational TestFactory To top of page

To measure code-based coverage of an executed script, the code of the application-under-test (AUT) must contain instrumentation points. The instrumentation points are counters that tally the parts of the code that a script executes. In Rational TestFactory, you can instrument either the object code or the source code of the AUT. Regardless of the instrumentation method you use, TestFactory maintains the integrity of your original source files or executable file.

When you execute test scripts in Rational TestFactory, two actions occur:

  • TestFactory passes each script to Rational Robot to execute.
  • As a script executes, TestFactory monitors the instrumentation points in the code to tally the code-based coverage information.

Help icon   Refer to the following topics in Rational TestFactory online Help:

  • Specifying information for a new project
  • Instrumenting the application-under-test
  • Run a single script

3.   Review code-based coverage data for each script To top of page

After you execute Rational Robot scripts in Rational TestFactory, the code-based coverage data is available for you to review. For each script, TestFactory displays an overall code-based coverage value—for both the application (or applet) and all the additional instrumented files that the application (or applet) calls. TestFactory also displays coverage information for each file and subroutine in the application.

Rational TestFactory calculates the code-based test coverage value as the percent of the source code that a test script touches, relative to all the source code in the application-under-test. If you have access to the source files for the application-under-test, you can use the Coverage Browser in TestFactory to review the lines of source code that each script covered—examining which source statements were executed and which were not.

You can also view the combined code-based coverage data for two or more Rational Robot scripts.

Help icon   Refer to the following topics in Rational TestFactory online Help:

  • Review coverage results for a script
  • View combined code coverage for multiple scripts
  • Code coverage for scripts in a Java application or applet

Copyright  © 1987 - 2001 Rational Software Corporation

Display Rational Unified Process using frames

Rational Unified Process