# MUnit Test Scope and Isolation

*MuleSoft Platform Architect Study Guide · Architecting and deploying API implementations · Last updated November 13, 2026 · https://www.certifyforce.com/study-guide/mulesoft-platform-architect/architecting-and-deploying-api-implementations/munit-test-scope-and-isolation*

Set MUnit boundaries for isolated flow tests and real integration checks, with explicit source lifetime, mocking prerequisites and validation evidence.

- Certification: Salesforce MuleSoft Platform Architect
- Exam section: Architecting and deploying API implementations
- Study guide: https://www.certifyforce.com/study-guide/mulesoft-platform-architect

**Official exam objective:**

> Compare unit and integration tests and specify where MUnit is best employed.

## What the exam expects

- Choose an isolated flow test or a test crossing a real integration boundary.
- Configure source activation and respect its test lifetime.
- Distinguish mock responses, event observation and invocation verification.
- Resolve initialization, domain and parameterized-suite prerequisites.

A **suite** contains MUnit tests; a **mock** replaces a processor call; a **Spy** observes execution; **Verify Call** checks invocation counts. These controls provide different evidence rather than interchangeable ways to make a test pass ([test structure](https://docs.mulesoft.com/munit/latest/munit-test-concept), [Mock When](https://docs.mulesoft.com/munit/latest/mock-event-processor), [Spy](https://docs.mulesoft.com/munit/latest/spy-event-processor), [Verify](https://docs.mulesoft.com/munit/latest/verify-event-processor)).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| Real listener test | Enable its source and call it during Execution. | [Sources](https://docs.mulesoft.com/munit/latest/enable-flow-sources-concept) |
| Initialization | Mocking does not remove connector startup prerequisites. | [Mock](https://docs.mulesoft.com/munit/latest/mock-event-processor) |
| Unsupported targets | Logger and Transform Message cannot be mocked directly. | [Mock](https://docs.mulesoft.com/munit/latest/mock-event-processor) |
| Dynamic responses | Then Call invokes helper-flow logic. | [Mock](https://docs.mulesoft.com/munit/latest/mock-event-processor) |
| Spy | Event changes inside it do not persist outside it. | [Spy](https://docs.mulesoft.com/munit/latest/spy-event-processor) |
| Counts | Verify Call works without a mock. | [Verify](https://docs.mulesoft.com/munit/latest/verify-event-processor) |
| Error scope | Out-of-scope mocked types become `MULE:UNKNOWN`. | [Mock](https://docs.mulesoft.com/munit/latest/mock-event-processor) |
| Domain preflight | Workspace, naming and Maven dependency resolution all matter. | [Domains](https://docs.mulesoft.com/munit/latest/munit-domain-support) |
| Data matrix | Parameterizations reuse test bodies with different values. | [Parameters](https://docs.mulesoft.com/munit/latest/parameterized) |
| Suite version | `minMuleVersion` establishes a floor. | [Structure](https://docs.mulesoft.com/munit/latest/munit-test-concept) |

## Check yourself

- When deliberately excluding an entire suite, where does `ignore="true"` belong?
- Why does an inline parameterization win when its key also exists in the suite's YAML parameterization file?
- When using `expectedErrorDescription`, which relationship between actual and expected text is accepted?

## Sources

- [MUnit Test Structure Fundamentals](https://docs.mulesoft.com/munit/latest/munit-test-concept)
- [Enable Flow Sources in MUnit](https://docs.mulesoft.com/munit/latest/enable-flow-sources-concept)
- [MUnit Mock When](https://docs.mulesoft.com/munit/latest/mock-event-processor)
- [MUnit Spy](https://docs.mulesoft.com/munit/latest/spy-event-processor)
- [MUnit Verify](https://docs.mulesoft.com/munit/latest/verify-event-processor)
- [MUnit Domain Support](https://docs.mulesoft.com/munit/latest/munit-domain-support)
- [MUnit Parameterized Test Suites](https://docs.mulesoft.com/munit/latest/parameterized)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 9 linked practice questions, and unlimited timed mock exams are included with the MuleSoft Platform Architect pack (USD $19): https://www.certifyforce.com/practice-exams
