Contact Us 1-800-596-4880

MUnit Support for Domain-Based Applications

logo acb active Anypoint Code Builder

logo studio active Anypoint Studio

MUnit supports testing Mule applications that reference a Mule domain, with minimal code changes required. Before running domain-based tests, ensure your domain is in your workspace, folder names match artifact IDs, and domain resources are installed in your M2 repository.

  • When working in Anypoint Studio, your Mule Domain must always be part of your workspace.

  • Your Folder must have the same name as your artifact.
    Regardless if it’s a Mule application or a Mule domain if, the folder in your workspace containing your Mule project must have the same name as the artifact ID defined in your pom file.

    For example, if your mule project’s artifact Id is:

    <artifactId>mule-project</artifactId>

    Then, the folder in your Studio workspace must be named mule-project.
    This is case sensitive. If your folder is named Mule-Project, MUnit won’t recognize your project.

  • Your resources need to be installed in an M2 repository.
    You need to handle domains and mule apps as regular dependencies. Setting them as an artifact requires for them to be installed in an .M2 repository.

  • Your resources need to be in your test suite pom file.

    If your Mule domain project looks like this:

    <modelVersion>4.0.0</modelVersion>
    <groupId>org.mule.app</groupId>
    <artifactId>domain-project</artifactId>
    <packaging>mule-domain</packaging>
    <version>1.0.0-SNAPSHOT</version>
    <name>Domain domain-project Project</name>

    Then your dependency in your Mule application should look like this:

    <dependency>
        <groupId>org.mule.app</groupId>
        <artifactId>domain-project</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <classifier>mule-domain</classifier>
        <scope>provided</scope>
    </dependency>

    Remember to keep consistency with <version> artifact in your repository and in your test suite’s pom file