Before you begin
You must generate and build a unit test case prior to collecting code coverage.
Unit test cases use the IBM® z/OS® Debugger to collect code coverage. To prepare a program for
code coverage, you must build it with certain compiler options. For more information on compiler
options for using z/OS Debugger to collect code coverage see Supported compilers and options for code coverage in remote debug
mode.
Procedure
- From either the z/OS Projects or Project Explorer view, right click on your unit test
(*.tc) file and select .
- If you have already run, debugged or collected code coverage for the unit test, the
previously created launch configuration will be reused to run the unit test in debug mode. If this
is the first time you run or debug the unit test, you will now be prompted to specify additional
information in the Unit Test tab of the launch configuration:
- Select the RSE connection where you would like to run the unit test, and where the
compiled unit test executable exists.
- The test case field should be prefilled with the unit test case file that you click on
in step 1.
- Specify the test case executable on the remote system. Use the Browse button to locate
the executable. Once you have specified a valid executable, the member names for the runner
configuration and result data sets are computed and filled in.
- The runner configuration data set is determined from your default local project
settings, and overridden by any project-specific settings. For more information, see Setting preferences for Unit Test.
- Optional: Update the runner configuration member name if the computed name
is not correct.
- Optional: Remove the selection for overwriting the remote runner data set
member if you wish to use the existing data set member instead of overwriting it with the local
runner configuration file that was created when you generated the unit test case.
- The runner result data set is determined from your default local project settings, and
overridden by any project specific settings. For more information, see Setting preferences for Unit Test.
- Optional: Update the runner result member name if the computed name is not
correct.
- Optional: Click the Modify Local project settings
link to open and modify the properties for the project containing the specified unit
test.
- Optional: Specify any desired code coverage options on the Code Coverage tab.
See Code Coverage Tab for more information.
- Optional: Specify any debug console commands you want to run during the code
coverage collection on the Debug Console Commands tab. See Debug Console Commands Tab for additional
information.
- Optional: Specify any additional launch configuration options in the Common
tab, such as saving the launch configuration to you. For more information, see Common Tab.
- Click the Compiled Code Coverage button to continue and run the
unit test.
- You will now see the job progress indicator appear, indicating what phase of JCL
generation and submission is happening.
- Once the job is submitted, you will see message CRRZI0784I appear. Select the option you
prefer to deal with the submitted job.
- Once the code coverage session and job completes, you will see the Unit Test Runner
Results editor open with the results of the unit test, and the code coverage result will appear in
the Code Coverage view, and get opened.
Results
Once you have collected code coverage for a unit test case and created a launch configuration,
you will not be prompted upon subsequent requests to run, debug or code coverage a unit test from
the context menu. You can also reuse and access the created launch configuration from:
- The Run Configurations menu option for the workbench
Run toolbar button , or the Run menu option from the
workbench main menu bar.
- The Debug Configurations menu option for the workbench
Debug toolbar button, or the Run menu option from the
workbench main menu bar.
- The Compiled Code Coverage Configurations menu option for the workbench
Compiled Coverage toolbar button, or the Run menu
option from the workbench main menu bar.