---
schema_version: "1"
id: 0c9503f1b15ff459d8662ce4f73ef6d4390ed57224cb9d8cba71e46fc74b96dd
title: Test Your Mule Projects with MUnit
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/studio/test-with-munit-in-studio.md
canonical_url: https://docs.mulesoft.com/studio/test-with-munit-in-studio
source_site: docs.mulesoft.com
content_type: documentation
content_hash: e107c71caa05342d4df437204147b381c89b1da02a0689137400f34ed45711f7
description: MuleSoft Documentation Site
latest: true
---
---
product: Studio
---

# Test Your Mule Projects with MUnit

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Use MUnit in Anypoint Studio to create, run, debug, and modify unit tests for your Mule projects.
MUnit is a MuleSoft unit testing framework for creating and running unit tests on a Mule
application, as described in [MUnit Overview](https://docs.mulesoft.com/munit/latest/).

In the MUnit windows, you can find information about your tests:

- Errors

- Failures

- Results

- Coverage

## Before You Begin

Learn more about MUnit:

- [MUnit Overview](https://docs.mulesoft.com/munit/latest/)

- [MUnit Test Structure Fundamentals](https://docs.mulesoft.com/munit/latest/munit-test-concept)

- [MUnit Event Processors](https://docs.mulesoft.com/munit/latest/event-processors)

- [MUnit Cookbook](https://docs.mulesoft.com/munit/latest/munit-cookbook)

## Get to Know MUnit Tests

You can perform the following tasks with MUnit in Studio:

- Create a test

- Create a test suite

- Run a test

- Debug your project

- Fix errors

- Generate test reports

When you work with your MUnit tests in Studio, you can:

- Find the test of your project in the `src/test/munit` folder, in **Package Explorer**.

- Drag components to your test from the **Mule Palette**, in **Message Flow**.

- Define the MUnit configuration for your tests from **Global Elements**.

- Review test XML files from **Configuration XML**.

## Create MUnit Tests and MUnit Test Suits

To create an MUnit test:

1.  Open your Mule project in Studio.

2.  Right-click on the **src/test/munit** folder, or create this folder if it doesn’t exist in your
    Mule project.

3.  Select **New** > **MUnit Test**.

4.  In the **MUnit test suite** window, write a name for your test suite.

5.  Select the flows to test from the list of flows available in your project.

6.  Click **Finish**.

> [!NOTE] You can also configure MUnit tests and test suites from the XML editor.

## Run MUnit Tests

You can run MUnit test in different ways in Studio:

- Right-click on your MUnit test suite file and select **MUnit** > **Run Test**.

- In **Message Flow**, right-click on your test flow, and select **Run MUnit suite**.

When you run a test, Studio creates a build and displays the progress and the result of the test in
the **Console** tab and the **MUnit** window. If all tests execute successfully, the build succeeds.
If there is an error, the build fails.

## Run MUnit Tests in Debug Mode

You can run your MUnit tests in debug mode to step through your code, inspect variables, and
understand the flow of your Mule application.

1.  Open your Mule project in Studio.

2.  In the **src/test/munit** folder, open the MUnit test suite to debug.

3.  In **Message Flow**, add a breakpoint by right-clicking on the element that must have the
    breakpoint.

4.  Right-click on your MUnit flow test and select **Debug MUnit test**.

## Enable Flow Sources

The `Enable Flow Sources` element within the MUnit test tells MUnit which flow sources to load and
execute for the test. By default, MUnit doesn’t start the event sources (flow sources such as
triggers and listeners).

You can define flow sources with the **Mule Properties** view of your MUnit test in Studio:

1.  Click **Add**.

2.  Select the name of the flow from **Name of the flow**.

Learn more about flow sources in MUnit docs
([Enable Flow Sources in MUnit](https://docs.mulesoft.com/munit/latest/enable-flow-sources-concept)) and configure which
flow sources must start for your tests.

## See Also

- [MUnit Cookbook](https://docs.mulesoft.com/munit/latest/munit-cookbook)

- [MUnit Test Structure Fundamentals](https://docs.mulesoft.com/munit/latest/munit-test-concept)

- [MUnit Event Processors](https://docs.mulesoft.com/munit/latest/event-processors)
