COVERAGE - Code Coverage of a Natural Session

#### Search Results

Search

# COVERAGE - Code Coverage of a Natural Session

This profile parameter is used to perform a code coverage of a Natural session. The coverage data is written to an NCVF (Natural coverage file) resource file you can analyze with NaturalONE or with the Natural Profiler utility. For more information, see the NaturalONE documentation or the Natural Profiler documentation.

Possible settings | See COVERAGE Parameter Syntax.
Default setting | none | See the default settings of the subparameters in COVERAGE Parameter Syntax.
Dynamic specification | yes
Specification within session | no

The following topics are covered:

- COVERAGE Parameter Syntax

- Examples of COVERAGE Parameter

## COVERAGE Parameter Syntax

The `COVERAGE` parameter is specified as follows:

COVERAGE={(subparameter=value[,subparameter=value]...)}

Important
Blank spaces are not allowed in the syntax. Use commas to separate the syntax elements.

Where:

Subparameter | Value | Description
--- | --- | ---
`ACTIVE` | `ACTIVE=value` determines whether the coverage infrastructure is activated. Default: `OFF`
`ON` | The coverage infrastructure is activated and coverage data is written to the resource file.
`OFF` | The coverage infrastructure is deactivated.
`RESLIB` | 1 - 8 characters | `RESLIB=value` specifies the name of the Natural library that contains the resource file. It is possible to specify an environment variable for `value`. Default: `SYSTEM`
`RESNAME` | 1 - 253 characters | `RESNAME=value` specifies the name of the resource file (without path and extension) into which the data is written. It is possible to specify an environment variable for `value`. Default: A file name is automatically generated containing the current user ID and timestamp.

## Examples of COVERAGE Parameter

### Example 1: Code coverage using the default resource

    COVERAGE=(ACTIVE=ON)

The coverage data is written to an NCVF resource file with a name containing the current user ID and timestamp in the library SYSTEM on the FUSER.

### Example 2: Code coverage using a specific resource

    COVERAGE=(ACTIVE=ON,RESNAME=MYAPP,RESLIB=MYLIB)

The coverage data is written to the resource file MYAPP.ncvf in the library MYLIB.

### Example 3: Code coverage using a variable

    $COVNAME='123'
                    $COVLIB='ABC'
                    COVERAGE=(ACTIVE=ON,RESNAME=$COVNAME,RESLIB=$COVLIB)

The coverage data is written to the resource file 123.ncvf in the library ABC.

Note
In a Windows environment, you could also use `%covname%` or `%covlib%` instead of `$COVNAME` or `$COVLIB`.

### On this page

- COVERAGE Parameter Syntax
- Examples of COVERAGE Parameter