DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Error Handling Inside Kumologica Subflow
  • How To Use JMS ActiveMQ With Mule 4 - Part 6
  • MuleSoft Integration With RabbitMQ
  • MuleSoft APIkit Router - QueryParam and Header Strict Validation Configuration

Trending

  • How to Create a Successful API Ecosystem
  • Event-Driven Microservices: How Kafka and RabbitMQ Power Scalable Systems
  • Apple and Anthropic Partner on AI-Powered Vibe-Coding Tool – Public Release TBD
  • Code Reviews: Building an AI-Powered GitHub Integration
  1. DZone
  2. Testing, Deployment, and Maintenance
  3. Testing, Tools, and Frameworks
  4. Exclude Flows and Files From MUnit Test Coverage

Exclude Flows and Files From MUnit Test Coverage

This articles explains the easiest way to exclude flows or files from MUnit Test Coverage report by adding few tags in your pom.xml.

By 
Nagaraju Kshathriya user avatar
Nagaraju Kshathriya
·
Jul. 23, 20 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
16.1K Views

Join the DZone community and get the full member experience.

Join For Free

1. Overview

In this article, we will discuss how to exclude flows and files in MUnit test. This is useful when you want to exclude unnecessary flows/files from MUnit test coverage. We also demonstrate how to run specific MUnit file or flow.

2. What Is MUnit?

MUnit is a Mule application testing framework which allows you to build automated tests for your Mule integrations and API’s. With MUnit you can mock, spy, tag processors. We will learn about these MUnit tools in next articles.

3. How to Exclude Flows and Files From MUnit Coverage?

Sometimes you may need to exclude particular files or flows from MUnit coverage. In such cases we can exclude entire file or specific flow from MUnit coverage.

Note: This will work only when you run test cases from terminal not from Anypoint Studio due to continuous integration.  

3.1 Ignore Files

Let’s see how to exclude files from MUnit coverage. To exclude files from coverage report you just need to add ignoreFiles tag in your pom file.

Plain Text
 




xxxxxxxxxx
1


 
1
<coverage>  
2
  <ignoreFiles>      <
3
     <ignoreFile>file-name.xml</ignoreFile>        
4
    <ignoreFile>file-name2.xml</ignoreFile>  
5
  </ignoreFiles> 
6
</coverage>



3.2 Ignore Flows

Let’s see how to exclude flows from MUnit coverage. To exclude files from coverage report you just need to add ignoreFlows tag in your pom file.

Plain Text
 




xxxxxxxxxx
1


 
1
<coverage>  
2
  <ignoreFlows>      <
3
     <ignoreFlow>file-name.xml</ignoreFlow>        
4
    <ignoreFlow>file-name2.xml</ignoreFlow>  
5
  </ignoreFlows> 
6
</coverage>



Make sure that the coverage tag must be included in the Mule Maven plugin configuration tag. For example: 

Plain Text
 




xxxxxxxxxx
1
19


 
1
<plugins>  
2
    <plugin>    
3
      <groupId>com.mulesoft.munit.tools</groupId>    
4
      <artifactId>munit-maven-plugin</artifactId>    
5
      <configuration>      ...      
6
         <coverage>           
7
           <ignoreFlows>      <
8
              <ignoreFlow>flow-name.xml</ignoreFlow>        
9
              <ignoreFlow>flow-name2.xml</ignoreFlow>  
10
           </ignoreFlows> 
11
           <ignoreFiles>      <
12
             <ignoreFile>file-name.xml</ignoreFile>        
13
             <ignoreFile>file-name2.xml</ignoreFile>  
14
           </ignoreFile> 
15
        </coverage>    
16
       ...    
17
    </configuration>  
18
     </plugin> 
19
</plugins>



4. Conclusion

In this short article, we have seen how to exclude files and flows from MUnit test coverage report and also demonstrated how run specific file from terminal. Stay Tuned for more MUnit articles and tips. Check out for more MuleSoft Articles.  Keep Learning!

Flow (web browser) Testing

Opinions expressed by DZone contributors are their own.

Related

  • Error Handling Inside Kumologica Subflow
  • How To Use JMS ActiveMQ With Mule 4 - Part 6
  • MuleSoft Integration With RabbitMQ
  • MuleSoft APIkit Router - QueryParam and Header Strict Validation Configuration

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!