Search code examples
mavenmunit

Does anyone know how to turn off MUnit Coverage analysis?


After my mock testing is complete and successful, the Maven plugin starts this:

[org.mule.munit.remote.CoverageManager]Calculating application coverage for resources:app-config.xml

I removed the configuration in my POM where coverage was set to "true". I changed to "false" and the coverage analysis continues.

Does anyone know how to turn this off?

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/POM/4.0.0   http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.dlw</groupId>
    <artifactId>billing-api</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <packaging>mule</packaging>
    <name>Acme Billing API Application</name>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

    <mule.version>3.8.0</mule.version>
    <mule.tools.version>1.1</mule.tools.version>
    <munit.version>1.2.0</munit.version>
    <mule.munit.support.version>3.8.0</mule.munit.support.version>
</properties>

<build>
    <plugins>
        <plugin>
            <groupId>org.mule.tools.maven</groupId>
            <artifactId>mule-app-maven-plugin</artifactId>
            <version>${mule.tools.version}</version>
            <extensions>true</extensions>
            <configuration>
                <copyToAppsDirectory>true</copyToAppsDirectory>
            <inclusions>
                    <inclusion>
                        <groupId>org.mule.modules</groupId>
                        <artifactId>mule-module-apikit</artifactId>
                    </inclusion>
                </inclusions>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-assembly-plugin</artifactId>
            <version>2.2.1</version>
            <configuration>
                <descriptorRefs>
                    <descriptorRef>project</descriptorRef>
                </descriptorRefs>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>build-helper-maven-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>add-resource</id>
                    <phase>generate-resources</phase>
                    <goals>
                        <goal>add-resource</goal>
                    </goals>
                    <configuration>
                        <resources>
                            <resource>
                                <directory>src/main/app/</directory>
                            </resource>
                            <resource>
                                <directory>mappings/</directory>
                            </resource>
                        <resource>
                                <directory>src/main/api/</directory>
                            </resource>
                        </resources>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    <plugin>
            <groupId>com.mulesoft.munit.tools</groupId>
            <artifactId>munit-maven-plugin</artifactId>
            <version>${munit.version}</version>
            <executions>
                <execution>
                    <id>test</id>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
    <testResources>
        <testResource>
            <directory>src/test/munit</directory>
        </testResource>
    <testResource>
            <directory>src/test/resources</directory>
        </testResource>
    <testResource>
            <directory>src/main/app</directory>
        </testResource>
    </testResources>
</build>

<!-- Mule Dependencies -->
<dependencies>
    <!-- Xml configuration -->
    <dependency>
        <groupId>com.mulesoft.muleesb</groupId>
        <artifactId>mule-core-ee</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Xml configuration -->
    <dependency>
        <groupId>com.mulesoft.muleesb.modules</groupId>
        <artifactId>mule-module-spring-config-ee</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Mule Transports -->
    <dependency>
        <groupId>org.mule.transports</groupId>
        <artifactId>mule-transport-file</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mule.transports</groupId>
        <artifactId>mule-transport-http</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.mulesoft.muleesb.transports</groupId>
        <artifactId>mule-transport-jdbc-ee</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.mulesoft.muleesb.transports</groupId>
        <artifactId>mule-transport-jms-ee</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mule.transports</groupId>
        <artifactId>mule-transport-vm</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- Mule Modules -->
    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-scripting</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-xml</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
    <!-- for testing -->
    <dependency>
        <groupId>org.mule.tests</groupId>
        <artifactId>mule-tests-functional</artifactId>
        <version>${mule.version}</version>
        <scope>test</scope>
    </dependency>
<dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-apikit</artifactId>
        <version>1.7.3</version>
    </dependency>
<dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-http</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
<dependency>
        <groupId>org.hoeggsoftware</groupId>
        <artifactId>acme-mule-domain</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <scope>test</scope>
        <type>zip</type>
    </dependency>
<dependency>
        <groupId>com.mulesoft.weave</groupId>
        <artifactId>mule-plugin-weave_2.11</artifactId>
        <version>${mule.version}</version>
        <scope>provided</scope>
    </dependency>
<dependency>
        <groupId>cglib</groupId>
        <artifactId>cglib</artifactId>
        <version>3.2.2</version>
        <scope>provided</scope>
    </dependency>
<dependency>
        <groupId>com.mulesoft.munit</groupId>
        <artifactId>mule-munit-support</artifactId>
        <version>${mule.munit.support.version}</version>
        <scope>test</scope>
    </dependency>
<dependency>
        <groupId>com.mulesoft.munit</groupId>
        <artifactId>munit-runner</artifactId>
        <version>${munit.version}</version>
        <scope>test</scope>
    </dependency>

</dependencies>

<repositories>
    <repository>
        <id>Hoegg</id>
        <name>Hoegg Software</name>
        <url>http://maven.hoegg.software:8081/nexus/content/repositories/MuleRepository/</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>Central</id>
        <name>Central</name>
        <url>http://repo1.maven.org/maven2/</url>
        <layout>default</layout>
    </repository>
    <repository>
        <id>mulesoft-releases</id>
        <name>MuleSoft Releases Repository</name>
        <url>http://repository.mulesoft.org/releases/</url>
        <layout>default</layout>
    </repository>
</repositories>
<pluginRepositories>
    <pluginRepository>
        <id>Hoegg</id>
        <name>Hoegg Software</name>
        <url>http://maven.hoegg.software:8081/nexus/content/repositories/MuleRepository/</url>
        <layout>default</layout>
    </pluginRepository>    
    <pluginRepository>
        <id>mulesoft-release</id>
        <name>mulesoft release repository</name>
        <layout>default</layout>
        <url>http://repository.mulesoft.org/releases/</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </pluginRepository>
</pluginRepositories>


Solution

  • There are two ways to turn off coverage analysis when MUnit is run:

    1. Do not provide any configuration in the MUnit plugin section within
    2. Set run coverage to false like so:

      <configuration>
        <coverage>
          <runCoverage>false</runCoverage>
          <formats>
            <format>html</format>
          </formats>
        </coverage>
      </configuration>
      

    NOTE: this configuration does not affect the behavior of MUnit within Anypoint Studio 6.0.3. The coverage analysis will still run if you select the MUnit test configuration (XML) and right-mouse/Run/MUnit