Code coverage filters

Code coverage filters can be used to include or exclude modules, parts or compile units, and files from results during collection.

You can specify filters in a file, and specify that filter list file with -r,filterlist=<path> in headless mode or in launch configurations with an Eclipse IDE. Only .txt files are supported. In an Eclipse IDE, you can use the Edit Code Coverage Filters window to view and edit the filters in the specified filter list file.

In headless mode, you can also specify the filters directly with -R,filter=<filters>.

Filtering parameters can be specified in the following format:
<filter_type> <module_filter> <part_filter> <file_filter>
where:
<filter_type>
Specifies the filter type: include filter (+) or exclude filter (-).
<module_filter>
Specifies the name or regular expression for modules.
<part_filter>
Specifies the name or regular expression for parts.
<file_filter>
Specifies the name or regular expression for files.
The default filter is + .* .* .*, which includes everything.
The following filter types are supported:
Comment line: #
Starts a comment line.
Exclude filter: -
Excludes specific modules, parts, or files. Regular expressions are supported in the filter.
The default filter is + .* .* .*, which includes everything. The exclude filters that you specify exclude matched results from the list that includes all.
Examples:
  • To exclude module MOD1, specify the following filter:
    - MOD1
    Fields to the right can be omitted and are defaulted to .*, which means any string is matched for parts and files.
  • To exclude a part with the name of "abc", specify the following filter:
    - .* abc .*
    You need to specify the field to the left for modules. The field to the right for files can be omitted and will be default to .* to match any files.
  • To exclude files ABC, Abc, and abc, specify the following filter:
    - .* .* (?i)abc
    The regular expression (?i) makes the string not case-sensitive .
  • To exclude all files that start with "abc", specify the following filter:
    - .* .* abc.*
    Adding .* after "abc" includes all files that start with "abc".
  • To exclude all files that start with "a" in module ABC, specify the following filter:
    - ABC .* a.*
Include filter: +
Includes only specific modules, parts, or files. Regular expressions are supported in the filter.
To enable this mode, first specify the "exclude all" filter - .* .* .* to override the default "include all" filter + .* .* .* before you add the include filters.
Examples:
  • To include file myfile.cob in part DEF in module ABC, specify the following:
    + ABC DEF \Qmyfile.cob\E
    When the string contains characters used by regular expressions, use \Q<string>\E to enclose the string. If you want to search for files starting with "myfile.cob", specify \Qmyfile.cob\E.* instead.
  • To include all modules that start with "ABC" or "DEF", specify the following filters:
    + ABC.*
    + DEF.*
    
    Example:
    Example of the file specified on the -filterlist=<path> parameter.
  • To include only files that end in "COB" or "CBL", specify the following filters:
    + .* .* .*COB
    + .* .* .*CBL
    Example:
    Example of the file specified on the -filterlist=<file> parameter.