2017-02-10 4 views
0

내 munit 흐름에서 변수를 테스트하려고하는데이 경우 munit 테스트 케이스에서 set-message를 사용하고 있습니다. 그러나 매번 테스트가 실패합니다. 어딘가에 뭔가 빠져있는 것 같아요. 어느 누구라도 나를 도울 수 있습니까? 다음은 참조 용 코드입니다.munit에서 변수를 테스트하는 방법

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

답변

0

M-단위 테스트 정장 사용 테스트 변수의 동일한을 어설 및 flowVars.fvar1 여기로 실제 값 필드에 변수 이름을 지정하고이 이름 URI 매개 변수를 전달하려고 기대 값을 제공합니다. 실제 값과 예상 값이 일치하지 않으면 테스트 실패 메시지가 표시됩니다. 이는 m- 단위로 변수를 테스트하는 방법입니다.

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> 

은 자세한 내용은 this post를 참조하십시오.