---
schema_version: "1"
id: a89941dae94cd320a22cfaec71edfdb2a0905a34ca3e75e6b8254aec4c35fb74
title: MUnit Cookbook
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/munit/latest/munit-cookbook.md
canonical_url: https://docs.mulesoft.com/munit/latest/munit-cookbook
source_site: docs.mulesoft.com
content_type: documentation
content_hash: a7cd6377ea503b5c62b738d8dc67f632a1607f65a07c937dc9cae5520d784d30
description: MuleSoft Documentation Site
release: "3.7"
latest: true
---
---
product: MUnit
version: 3.7
is-latest-version: true
---

# MUnit Cookbook

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

![logo acb active](/mulesoft/current/en-us/_/img/icons/anypoint-code-builder.svg "Anypoint Code Builder")Anypoint Code
Builder

![logo studio active](/mulesoft/current/en-us/_/img/icons/studio.svg "Anypoint Studio")Anypoint Studio

MUnit cookbooks are step-by-step examples that demonstrate common MUnit testing patterns, including
mocking, error handling, environment properties, and utility classes.

<table><colgroup><col> <col></colgroup><thead><tr><th>Example</th><th>Description</th></tr></thead><tbody><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/mock-file-cookbook">Mock Resources for MUnit Tests with DataWeave</a></p></div></div></td><td><div><div><p>Mocking test code for your MUnit tests.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/mock-before-after-foreach-cookbook">Mock Messages Before and Inside a Foreach Processor in MUnit</a></p></div></div></td><td><div><div><p>Mocking a processor that can return different payloads.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/test-mock-errors-cookbook">Test and Mock Errors in MUnit</a></p></div></div></td><td><div><div><p>Mocking expected errors in your code.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/use-environment-properties-on-tests-cookbook">Test MUnit Flows with Environment Properties</a></p></div></div></td><td><div><div><p>Loading different environment values to your MUnit tests.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/utility-classes-cookbook">Use Utility Classes in MUnit Tests</a></p></div></div></td><td><div><div><p>Using custom Java classes in your MUnit tests.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/ftp-server-cookbook">Configure the MUnit FTP Server Utility</a></p></div></div></td><td><div><div><p>Configuring an FTP utility to test your FTP server connections.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/db-server-cookbook">Configure the MUnit Database Server Utility</a></p></div></div></td><td><div><div><p>Configuring a database utility to test your database connections.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/runtime-patching">Patch the Embedded Mule Runtime Engine Version in MUnit</a></p></div></div></td><td><div><div><p>Configuring MUnit to run against a patched Mule runtime engine version.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/domain-based-application-cookbook">Test MUnit Domain-Based Applications</a></p></div></div></td><td><div><div><p>Testing Mule applications that inherit a Mule domain.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/test-flow-with-scheduler-cookbook">Test a Flow with a Scheduler Source in MUnit</a></p></div></div></td><td><div><div><p>Testing a flow that is triggered by a scheduler.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/test-recorder-examples">Record an MUnit Test from an Anypoint Exchange Example</a></p></div></div></td><td><div><div><p>Using the MUnit test recorder.</p></div></div></td></tr><tr><td><div><div><p><a href="https://docs.mulesoft.com/munit/latest/test-processor-that-uses-target-variable">Test MUnit Processors That Use Target Variables</a></p></div></div></td><td><div><div><p>Ensuring that the assertions check the content of the stored variable.</p></div></div></td></tr></tbody></table>
