MUnit test cases should be independent and deterministic. A test for Flow-2 should not depend on another test case for Flow-1 executing first and leaving data behind. Such sequencing creates inter-test coupling, making test results dependent on execution order and complicating parallel execution, maintenance, and failure isolation.
The appropriate technique is to use Set Event in the Flow-2 test to construct the Mule Event that Flow-2 requires as input. MuleSoft documents Set Event as the processor normally placed at the start of an MUnit test to define the initial event sent to the flow being tested. It can independently define the payload, message attributes, and event variables.
Consequently, the Flow-2 tests can explicitly reproduce the payload or variables that Flow-1 would normally provide in production without requiring the Flow-1 test suite to execute first.
Before Test Case and After Test Case hooks are useful for setup and cleanup but should not be used to transfer output between otherwise separate unit tests. Chaining test suites similarly creates avoidable dependencies between tests.
Reference topics: MUnit; Set Event; independent unit tests; payload and variable initialization; deterministic testing.
Official documentation: https://docs.mulesoft.com/munit/3.6/set-event-processor
===============================================================