Filtering code coverage results during collection
You can use filters to include or exclude modules, parts or compile units, and files during code coverage collection.
Filtering code coverage results during collection is supported with an Eclipse IDE and in headless mode.
Filtering results during collection with an Eclipse IDE
To filter results during code coverage collection, specify a filter list file that contains valid
code coverage filters.
- From the main toolbar, click the down arrow to the right of the Compiled Code Coverage icon () and select Compiled Code Coverage Configurations. The Compiled Code Coverage Configurations wizard opens.
- Select or create a launch configuration for z/OS Batch Application using existing JCL or z/OS UNIX applications.
- On the Code Coverage tab, select Filter list file to enable this option.
- Specify a filter list file. You can enter the file path directly, or click Browse to select a file. Only .txt files are supported.
- To update filters in this file, click Edit. The Edit Code Coverage Filters window opens. The filters retrieved from the file are displayed in the window. You can use this window to add, edit, remove, or reorder the code coverage filters.
Note:
- z/OS Batch Application using a property group launch configurations do not support adding filters for code coverage collection.
Filtering results during collection in headless mode
When you run code coverage in headless mode, you can specify
-R,filter=<filters>
or -r,filterlist=<path>
to filter code
coverage results during collection.-R,filter=<filters>
- Specifies a list of filters that are enclosed in single or double quotation marks. Use commas to separate the filters. The filters allow strings or regular expressions to include or exclude modules, parts, and files.
-r,filterlist=<path>
- Specifies a file that contains a list of filters to include or exclude module, parts, and files. Each filter appears on a separate line.
For more information on how to specify the filters, see Code coverage filters.
Notes:
- Headless code coverage is not available on macOS.
- If multiple filters match the same module, part, or file, the last filter in the
R,filter=<filters>
or the file specified in-r,filterlist=<path>
is used.- The path specified in
-r,filterlist=<path>
must match the file specification format where code coverage collection is running. See the following examples:- If you run code coverage collection on z/OS, the path must be a z/OS UNIX file:
output=/u/user1/filterlist.text
. - If you run code coverage collection using the Eclipse UI on Windows, the path must be a Windows
file or path name such as
output=C:\Users\Admin\filterlist.txt
oroutput=C:/Users/Admin/filterlist.txt
.
- If you run code coverage collection on z/OS, the path must be a z/OS UNIX file:
- The file specified in
-r,filterlist=<path>
must be a single .txt file.
- The path specified in
- Messages are included in the results to indicate which items were excluded. The messages are displayed when you open the results in the client.
- If an invalid regular expression is specified in a filter, the headless code coverage collector will not start.
- If no result is available with the specified filters, a message appears indicating that no result is created.