如何在 Munit 中为功能测试用例附加文件 - Mule ESB
How to attach file in Munit for functional test cases- Mule ESB
我需要通过 Munit 进行端到端(功能测试)测试。为此,我需要附加实际有效载荷,即图像。我如何在入站消息处理器中附加图像(Munit - 设置消息,没有附件选项)或我们可以实现此目的的任何其他方式。
<flow name="TestImage">
<file:inbound-endpoint path="tmp\imageUpload" responseTimeout="10000" doc:name="ImageFlow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:inbound-endpoint>
............. many processor..... Logic involved...
<file:outbound-endpoint path="tmp\Upload" responseTimeout="10000" doc:name="Flow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:outbound-endpoint>
Mule Studio 版本:5.3.1
文件入站端点默认return一个输入流作为负载,其中包含您要读取的文件的内容。
现在 MUnit 默认禁用入站端点,因此要测试此流程,您必须对流程进行流程引用 "TestImage"。
在这种情况下,您可以使用设置的消息处理器并按以下方式加载要使用的测试文件:
<munit:set payload="#[getResource('test_image.jpeg').asStream()]" doc:name="Set Message"/>
这将创建一条消息,其有效负载是您的图像的输入流。
HTH.
我需要通过 Munit 进行端到端(功能测试)测试。为此,我需要附加实际有效载荷,即图像。我如何在入站消息处理器中附加图像(Munit - 设置消息,没有附件选项)或我们可以实现此目的的任何其他方式。
<flow name="TestImage">
<file:inbound-endpoint path="tmp\imageUpload" responseTimeout="10000" doc:name="ImageFlow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:inbound-endpoint>
............. many processor..... Logic involved...
<file:outbound-endpoint path="tmp\Upload" responseTimeout="10000" doc:name="Flow" connector-ref="fileConn" fileAge="100" pollingFrequency="500"></file:outbound-endpoint>
Mule Studio 版本:5.3.1
文件入站端点默认return一个输入流作为负载,其中包含您要读取的文件的内容。
现在 MUnit 默认禁用入站端点,因此要测试此流程,您必须对流程进行流程引用 "TestImage"。 在这种情况下,您可以使用设置的消息处理器并按以下方式加载要使用的测试文件:
<munit:set payload="#[getResource('test_image.jpeg').asStream()]" doc:name="Set Message"/>
这将创建一条消息,其有效负载是您的图像的输入流。
HTH.