Main Content

Coverage Filter Rules and Files

What Is a Coverage Filter Rule?

A coverage filter rule specifies a model object, a set of objects, or lines of code that you want to exclude from coverage recording or that you want to justify for coverage.

Each coverage filter rule includes the following fields:

  • Name—Name or path of the object to filter from coverage

  • Type—Whether a specific object is filtered or all objects of a given type are filtered

  • Mode—Whether the object to be filtered is Excluded or Justified

    Coverage reports do not include Excluded blocks. The coverage reports assume that Justified blocks receive full coverage, but show that they are distinct from other covered blocks in the coverage report.

  • Rationale—An optional description that describes why this object is filtered from coverage

What Is a Coverage Filter File?

A coverage filter file is a set of coverage filter rules. Each rule specifies one or more objects or lines of code to exclude from coverage recording.

After you create and apply coverage filter rules, the specified objects or lines of code are excluded from coverage when you generate a report. You can reuse a coverage filter file for several Simulink® models.

When you make changes to the coverage filter rules after you record coverage, you can update the coverage report without needing to resimulate your model. After you make changes, click Apply, then click Generate Report in the Applied filters section of the coverage Results Explorer to update the report.

If you use the default file name for the active model, and the coverage filter file exists on the MATLAB® path, you see the coverage filter rules each time that you open the model. To save your current coverage filter rules to a file, click Save filter. To load an existing coverage filter file, click Load filter.

For more information on filtering objects, see Create, Edit, and View Coverage Filter Rules and Creating and Using Coverage Filters.