MUnit is a Mule application testing framework that allows you to easily build automated tests for your integrations and APIs. It provides a full suite of integration and unit test capabilities, and is fully integrated with Maven and Surefire for integration with your continuous deployment environment.
2. Introduction
MUnit is a Mule application testing framework that allows you to easily
build automated tests for your integrations and APIs. It provides a full
suite of integration and unit test capabilities, and is fully integrated with
Maven and Surefire for integration with your continuous deployment
environment.
3. What all can MUnit do?
With MUnit you can:
Create your Mule test by writing Mule code
Create your Mule test by writing Java code
Disable flow inbound endpoints
Disable endpoint connectors
Mock outbound endpoints
Mock message processors
Spy any message processor
Verify message processor calls
4. What all can MUnit do? …continued
Create not only unit tests but also integration tests in a local environment — MUnit
allows you to start a local FTP/SFTP, DB server or mail server
Call the Mule client from Mule code
Assert flow exceptions
Enable or disable particular tests
See assertion/error reports with Mule stack trace
Extend the MUnit framework with plugins
Check visual coverage in Studio
Debug your tests with Studio
5. MUnit Versions
As of July 7th 2016, the current release of MUnit is 1.2.0. It’s the only MUnit
version required independently of the Mule version being tested.
MUnit version 1.2.0, works with all Mule versions since 3.6.0 (for 3.6.x
minor limitations)
6. MUnit Compatibility
MUnit is divided among several sub modules. From a user’s point of view there are
only two that are really important. Both modules are compatible amongst
themselves.
The important sub modules are:
MUnit - The latest MUnit works with any
Mule version from 3.6.x.
These compatibility rules are followed:
Mule MUnit Support - The Mule MUnit
Support module is meant
to follow Mule ESB releases:
7. MUnit and Anypoint Studio
MUnit is fully integrated with Anypoint Studio, allowing you to create,
design and run MUnit tests just like you would Mule applications. You can
also use Anypoint Studio’s Studio Visual Debugger to debug your MUnit
tests.
MUnit is fully integrated with Anypoint Studio. You can use Studio’s
graphical interface to:
Create and design MUnit tests
Run your tests
View test results and coverage
Debug your tests
8. MUnit Suite
The base file in the MUnit Framework is the MUnit Test Suite file. These
files are the .xml files located under the src/test/munit folder in your Mule
application’s folder structure. Each MUnit Test Suite file is a collection of
MUnit tests. It is meant to work on its own, and should be able to run
independently from other MUnit test suite files.
9. Components of an MUnit Test Suite
An MUnit test suite file should contain any combination of the following
components:
Imports
Bean Definitions
Before/After Suites
Before/After Tests
MUnit Tests