Unit testing 使用JUnit模拟Mule变量
对于下面的Mule流,如何使用JUnit模拟随机变量Unit testing 使用JUnit模拟Mule变量,unit-testing,junit,mule,mule-studio,Unit Testing,Junit,Mule,Mule Studio,对于下面的Mule流,如何使用JUnit模拟随机变量 <flow name="FLOW1" doc:name="FLOW1"> <choice doc:name="Choice"> <when expression="${random_var} == 'true'"> <logger message="Random var is True" level="DEBUG" doc:name="Logger"/&
<flow name="FLOW1" doc:name="FLOW1">
<choice doc:name="Choice">
<when expression="${random_var} == 'true'">
<logger message="Random var is True" level="DEBUG" doc:name="Logger"/>
</when>
<otherwise>
<logger message="Random var is False" level="DEBUG" doc:name="Logger"/>
</otherwise>
</choice>
</flow>
我认为首先您需要一个vm端点,以便能够从功能测试中调用此测试 此外,您还应了解: 用于使用单元测试以编程方式调用vm端点。 它还描述了如何将有效负载传递给它 Func测试还将使用一组单独的配置文件,以便您可以为流定义一个单独的配置,这似乎是您正在寻找的。 您通常在哪里定义此变量?在application-config.xml中? func测试允许使用测试配置运行流您显然可以使用相同的配置在Mule app服务器中测试和运行流
Sebastian您如何在测试中调用此流?@user1760178,使用VM端点。流显然是不完整的,因为它不包含任何端点。我的问题更多的是关于从JUnit为random_var赋值的问题。我将在Spring.properties文件中定义这个变量。