0

我正在尝试在我的 munit 流中测试变量,为此我在 munit 测试用例中使用了 set-message。但是,测试每次都失败。我想我在某处遗漏了一些东西。任何人都可以帮助我。以下是我的代码供参考。

<set-variable variableName="fvar1" variableValue="#[message.inboundProperties.'http.uri.params'.name]" doc:name="Variable">
4

2 回答 2

0

对于 M-unit test-suit 中的测试变量,请使用 Assert equal 并在实际值字段中指定您的变量名称,例如此处的 flowVars.fvar1 并提供您将在 name uri 参数中传递的预期值。如果实际值和预期值不匹配,则会显示测试失败消息,这是以 m 为单位测试变量的方法。

于 2017-02-10T19:09:23.747 回答
0

您可以像这样测试变量 -

<munit:test name="testmule-test-suite-SampleMuleFlowTest" description="Test">
    <munit:set payload="#[getResources('test.txt').asStream()]" doc:name="Set Message">
        <munit:invocation-properties>
            <munit:invocation-property key="fileName2" value="test2.txt"/>
        </munit:invocation-properties>
        <munit:inbound-properties>
            <munit:inbound-property key="originalFilename" value="test.txt"/>
        </munit:inbound-properties>
    </munit:set>
    <flow-ref name="SampleMuleFlow" doc:name="Flow-ref to SampleMuleFlow"/>
    <munit:assert-on-equals expectedValue="#[flowVars.fileName2]" actualValue="#['test2.txt']" doc:name="Assert Equals"/>
</munit:test>

有关更多详细信息,请参阅此帖子

于 2017-06-14T15:08:16.263 回答