Contact Us 1-800-596-4880

Coverage

The MUnit Coverage feature provides a measurement of how much of a Mule application has been executed by a set of MUnit tests by counting the amount of event processors executed. This allows you to obtain a quality standard for your application, and provides metrics for:

  • Application overall coverage: An average of the items below.

  • Resource coverage: Refers to each Mule configuration file under src/main/mule.

  • Flow coverage: Refers to any of the following components: Flows, Sub-flows, and Batch jobs.

Coverage report runs only for EE edition runtimes. If your application has a requiredProduct of a Mule CE runtime you will see the following message: Coverage is a EE only feature and you’ve selected to run over CE. To run against an EE runtime see Specifying the Runtime Product.

The following is a coverage report sample in JSON format.
Use the code callouts below to understand each field in the report:

MUnit Coverage - sample JSON report
{
  "coverage": 75.0, (1)
  "requiredApplicationCoverage": 40.0, (2)
  "requiredResourceCoverage": 30.0,    (2)
  "requiredFlowCoverage": 25.0,        (2)
  "flowCount": 3,             (3)
  "processorCount": 4,        (4)
  "coveredProcessorCount": 3, (5)
  "files": [ {
    "name": "file1.xml", (6)
    "flowCount": 1,      (7)
    "coverage": 100.0,   (8)
    "processorCount": 2, (9)
    "weight": 50.0,     (10)
    "flows": [ {
      "name": "file1Flow1", (11)
      "type": "FLOW",       (12)
      "coverage": 100.0,    (13)
      "messageProcessorCount": 2, (14)
      "coveredProcessorCount": 2, (15)
      "lines": [ { (16)
        "lineNumber": 11,
        "covered": true
      }, {
        "lineNumber": 12,
        "covered": true
      } ]
    } ]
  }, {
    "name": "file2.xml",
    "flowCount": 2,
    "coverage": 50.0,
    "processorCount": 2,
    "weight": 50.0,
    "flows": [ {
      "name": "file2Flow2",
      "type": "SCOPE",
      "coverage": 100.0,
      "messageProcessorCount": 1,
      "coveredProcessorCount": 1,
      "lines": [ {
        "lineNumber": 10,
        "covered": true
      } ]
    }, {
      "name": "file2Flow1",
      "type": "SCOPE",
      "coverage": 0.0,
      "messageProcessorCount": 1,
      "coveredProcessorCount": 0,
      "lines": [  {
        "lineNumber": 7,
        "covered": false
      } ]
    } ]
  } ]
}
1 Coverage percentage of the whole application.
2 Required coverages for application, resources, and flows. If not configured, they default to -1.
3 Amount of flows in the application.
4 Amount of event processors in the application.
5 Amount of covered event processors.
6 Name of that file.
7 Amount of flows in that file.
8 Coverage percentage of that file.
9 Amount of event processors in that file.
10 Contribution of that file to the coverage percentage of the whole application.
11 Name of the flow.
12 Type of the top level element.
Other type of top level element in coverage is error-handler.
13 Coverage percentage of that flow.
14 Amount of event processors in that flow.
15 Amount of event processors covered in that flow.
16 XML line numbers containing event processors in that file, and whether they were covered or not.