Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

MUnit

Overview

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.

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

  • 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

MUnit Versions

The current release of MUnit is 1.2.0. It’s the only MUnit version required independently of the Mule version being tested. See the Release Notes to see what’s new.

MUnit version 1.2.0, works with all Mule versions since 3.6.0 (for 3.6.x minor limitations, see MUnit Release Notes - Compatibility Information).

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:

    MUnit Version Mule MUnit Support Version

    1.0.x

    3.6.x, 3.7.x

    1.1.x

    3.6.x, 3.7.x

    1.2.x

    All versions since 3.6.x

  • Mule MUnit Support - The Mule MUnit Support module is meant to follow Mule ESB releases:

    Mule MUnit Support Version Mule ESB Version

    3.6.x

    3.6.0 to 3.6.x

    3.7.x

    3.7.0 to 3.7.x

    3.8.x

    3.8.0 to 3.8.x

    The x at the end of each version number refers to the latest version within that minor version.
    Currently the latest released versions of Mule MUnit Support are: 3.6.3, 3.7.3, 3.8.0.

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.

For an overview of MUnit in Anypoint Studio, see Using MUnit in Anypoint Studio.

What’s in These Docs

The pages listed below provide an overview of MUnit features including simple examples. Topics include the MUnit message processors, the DB and FTP servers provided by MUnit, Maven support and more. For a short step-by-step guide to creating a test, see the MUnit Tutorial.

The examples in these pages are XML-only; however, as stated above, you can also use MUnit via Anypoint Studio’s graphical interface. See Using MUnit in Anypoint Studio for details.