a.cayzer
a.cayzer

Reputation: 289

Can you stop an MUnit test part way through a flow?

I am writing an MUnit test to test a sub-flow is called but once the sub-flow has been called the test tries to route through the rest of the flow. Without mocking various processors this means the test will fail.

Is it possible to stop a test when it reaches a certain processor? I.e. when message processor matches X Stop test?

Upvotes: 0

Views: 653

Answers (2)

Dds
Dds

Reputation: 712

What tbriscope said makes a lot of sense. If what comes after that key MP (message processor) cause a problem for your test it may be an indicator for you to break that flow so it gets more testable, maintainable and readable.

That said, you can use a Spy. It will allow you to see what's happening with that MP and, if you choose to do so, throw throw an exception (assertion failure or just a plain fail) which will cause the flow to stop. Please bear in mind there is no way to stop the flow unless you throw an exception (which means you can also use the throw-an MUnit MP).

HTH

Upvotes: 3

tbriscoe
tbriscoe

Reputation: 160

What about extracting the rest of the flow to its own subflow and mock it instead?

Upvotes: 0

Related Questions