Using Coverage in Studio
You can run a coverage report from Anypoint Studio.
The following configurations apply only when you execute your MUnit tests in Studio. They do not apply when running tests from Maven in a CI/CD environment.
To run coverage reports from Maven see Maven Configuration for Coverage.
Enable Coverage Reports in Anypoint Studio
You can see which flows, and which percentage of event processors in those flows the test covers by clicking on the Coverage button:
The Overall Coverage value represents the percentage of the Mule application event processors that the MUnit test executes.
You can click Generate Report to get the report that details the flows and event processors in the Mule configuration files that are included in the MUnit test.
Column | Description |
---|---|
Resource |
Name of the Mule configuration file |
Containers |
Number of flows inside the Mule configuration file |
Weight |
Percentage of your application in a configuration file |
Coverage |
Percentage of event processors in the Mule configuration file that the MUnit test executes |
Additionally, you can click on each Resource to get a more specific and granular report of the Event Processors executed in that resource:
Column | Description |
---|---|
Name |
Name of the container |
Type |
Type of the container |
Covered Processors |
Processors inside the container that are executed during the MUnit test |
Processors |
Total amount of processors inside the container |
Coverage |
Percentage of the event processors inside the container executed in the MUnit test |
Disable Coverage Reports
If you choose so, you can disable the coverage calculation from your project run configuration so you test your flow without a coverage report.
Right-click Package Explorer and choose Run As > Run Configurations. Select your MUnit run configuration file to access your suite configuration, and deselect the Run coverage option in your coverage settings.
Exclude XML Files from MUnit Coverage Report
You can exclude one or more XML files from an MUnit Coverage report when testing your application. For example, you can exclude a third-party XML file that does not comply with your quality standards to improve your final report score.
-
Go to the flow to change.
-
Click Run > Run Configuration.
-
Click the name of your project.
-
In the Ignored files section, click Add.
-
Type the name of the XML file to exclude from the Coverage report and click OK.
-
Click Apply and Run.