Test Coverage Configuration File

Note: This facility is supported in native COBOL only.

If you are using Test Coverage from the command prompt, you need to use it with a configuration file. An example test coverage configuration file, default.tcf, is supplied in %ProgramFiles(x86)%\Micro Focus\Visual COBOL\etc (Windows) or $COBDIR/etc (UNIX). You can edit this or use it as is.

The configuration is a text file that has the format:

[TESTCOVER]
; comment
RESULT filename.tcz [ACCUMULATE]
ECHOLOG [YES|NO]
LOGNAME [filename]
where the options are:
[TESTCOVER]
The configuration file must contain this tag. It identifies the file as a test coverage configuration file.
; comment
The semicolon (;) identifies a comment line. The semicolon must be positioned in the first column of the file. Comments can appear anywhere in the file. Optional.
RESULT filename.tcz [ACCUMULATE]
Specifies the results (.tcz) files to create. Your configuration file must contain a RESULT keyword.
ACCUMULATE
Optional. If specified, test coverage accumulates the results of succesive runs in a single results file filename.tcz.

If you omit ACCUMULATE, on each run test coverage overwrites filename.tcz, unless you use the variable version of filename.tcz (see below).

filename.tcz
The name of the file that is to hold test coverage results. If the file does not exist, a new file is created.

filename.tcz can include the following:

  • an absolute or relative pathname. If the pathname includes the name of a folder that does not exist, the folder is created, for example:
    RESULT tcresult.tcz

    creates the results file tcresult.tcz in the current folder, while

    RESULT ./results/tcresult.tcz

    creates the results file tcresult.tcz in the folder results, which will be created below the current folder.

  • a variable filename, by using the question mark (?) wildcard in the name.

    In this case, the filename should be specified in the form str????.tcz, where str can be any appropriate string. Test coverage then looks for files which match the wildcard string str????.tcz. It then takes the highest numeric value found in the wildcard character positions, increments that value, and uses this as the filename to which to write results.

    For example, if you specify the filename as x????.tcz, and the files x0001.tcz and x0002.tcz already exist, then test coverage automatically creates x0003.tcz.

    The number generated has as many digits as there are wild cards. For example x??.ccz generates x01.ccz, x02.ccz, and so on.

    Using a variable filename enables you to create separate results files for multiple runs of test coverage, without needing to change the configuration file for each run.

  • the token <pid>, which is replaced by the current process id, for example:
    RESULT myres_<pid>.tcz

    creates the results file myres_2749.tcz, assuming a process id of 2749.

ECHOLOG [YES|NO]
Specifies whether the test coverage summary should be echoed to the screen or not. Optional.

If you do not specify an option, or the keyword is omitted, the default is YES.

Use ECHOLOG NO if your application might have problems accessing the screen; for example, during debugging.

LOGNAME [filename]
At the end of each run, the test coverage summary is appended to filename. If filename is not specified, a default file is used, with the name projectdir\testcover\testcover.log, where projectdir is the folder in which your project is located. Optional.

The filename specified for the LOGNAME keyword can include the token <pid>. See the description of the RESULT keyword for more information on this token.

We recommend that a configuration file should contain at least the following:

[TESTCOVER]
ECHOLOG NO
RESULT filename.tcz ACCUMULATE
		
Note: Only one RESULT, ECHOLOG and LOGNAME keyword are allowed. You can have more than one instance of each of the keywords if they are non-active; that is, preceded by the semicolon (;) comment character.

Examples of the RESULT keyword

Windows:
RESULT .\results\tcresult.tcz ACCUMULATE
UNIX:
RESULT /usr/mydir/results/tcresult.tcz ACCUMULATE

Test coverage accumulates all results in the tcresult.tcz, located in the folder results relative to the current folder.

Windows:
RESULT c:\myres\tcresult.tcz
UNIX:
RESULT /usr/mydir/tcresult.tcz

As the ACCUMLATE verb has been omitted, test coverage stores its results in the file tcresult.tcz, which will be overwritten on each run.

RESULT run????.tcz

Separate results files are used for each run. In this example, on the first run, test coverage would create the results file run0001.tcz. On the second run, test coverage would create the results file run0002.tcz. The number would increment for each additional run.

Configuration file example

[TESTCOVER]
RESULT run????.tcz
ECHO NO
LOGNAME testcover.log

This example shows a complete configuration file. Separate results files are used for each run. Results are not to be echoed to the screen. Summary results are to be appended to testcover.log.