QuestionQ6

VerifiedManaging APIs and integrations

An organization enforces strict unit-test requirements: every Mule application must include an MUnit test suite with a test case defined for each flow and at least 80 percent test coverage.

A developer is creating an MUnit test suite for a newly developed Mule application that sends API requests to an external REST API.

What is an effective way to execute the MUnit tests for this Mule application successfully while still meeting the required MUnit test coverage?

Explanation

MUnit can mock the http:request event processor and use then-return to supply a controlled payload, variables, attributes, or error. This isolates the application from the external REST API while allowing each Mule flow and its logic to be executed and covered reliably.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!