Arun Rahul
Arun Rahul

Reputation: 605

Munit - Testing sub-flow

I am having a flow as follows

<flow name="MyMainFlow">
    <flow-ref name="MySubFlow" >
</flow>
<sub-flow name="MySubFlow">
    ------
</sub-flow>

While testing with Munit I am getting class not found exception . Due to some reasons I am not allowed to test through mule files . Is there any way where I could test sub-flow with Munit?

Upvotes: 1

Views: 1634

Answers (3)

vikram kumar u
vikram kumar u

Reputation: 205

Subflow can be tested from parent flow which called by using the flow -ref.

you can try with latest versions of munit 3.5.2-m2 version.

Upvotes: 0

Fefe
Fefe

Reputation: 91

You can do a flow ref to a sub flow

https://github.com/mulesoft/munit/blob/munit-3.5.x/munit-integration-tests/src/test/munit/assertion-munit-test.xml#L83

The class not found exception is related with your test classpath, can we have a stacktrace?

Upvotes: 0

Gabriel Dimech
Gabriel Dimech

Reputation: 699

I was able to test a sub flow using the following flow and sub-flow:

<flow name="main">
    <vm:inbound-endpoint path="in"/>
        <flow-ref name="MySubFlow" />
    <vm:outbound-endpoint path="out"/>
</flow>

<sub-flow name="MySubFlow">
    <append-string-transformer message=" Received"/>
</sub-flow>

and the following munit test:

<munit:test name="test" description="Create your test here">
    <munit:set payload-ref="#[string: Hello world!]"/>
    <munit:assert-not-null/>
</munit:test>

Upvotes: 1

Related Questions