Tool Mentors > Rational TestFactory Tool Mentors > Using Rational TestFactory to Measure and Evaluate Code-based Test Coverage on Rational Robot Test Scripts

Purpose

This tool mentor describes how to use Rational TestFactory to measure and evaluate code-based test coverage for Rational Robot Test 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 Scripts, and then execute the resulting Test Scripts as part of a Test Suite. While Robot does not have an inbuilt feature to collect and analyze code-base test coverage, when you execute the Robot Test Scripts using Rational TestFactory, TestFactory has the capability of calculating code-based coverage metrics for the 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 Test Scripts:

  1. Record or program Test Scripts in Rational Robot
  2. Execute the Rational Robot Test Scripts in Rational TestFactory
  3. Review code-based coverage data for each Test 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: Implementing Test Scripts Using Rational Robot.

Note: For Rational TestFactory to calculate code-based coverage data successfully for Rational Robot Test Scripts, each Test 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 Test Scripts in Rational TestFactory To top of page

To measure code-based coverage of an executed Test 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 Test 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 Test Script to Rational Robot to execute.
  • As a Test 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 Test Script

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

After you execute Rational Robot Test Scripts in Rational TestFactory, the code-based coverage data is available for you to review. For each Test 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 Test 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 Test 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