Upgrade to Pro — share decks privately, control downloads, hide ads and more …

MUnit Testing With Mulesoft-Part I

MUnit Testing With Mulesoft-Part I

MUnit Testing With Mulesoft-Part I

Jitendra Bafna

May 15, 2017
Tweet

More Decks by Jitendra Bafna

Other Decks in Technology

Transcript

  1. MUnit Testing With Mulesoft MUnit is a mule application testing

    framework which allows you to build automated tests for your mule integrations and API's. MUnit is very well integrated with Anypoint Studio. Various features available with Mule MUnit • Create and build Mule tests by writing Mule code. • Create and build Mule tests by writing Java code. • Verify Message Processor calls. • Mock Message Processor. • Mock outbound endpoints. • Disable outbound endpoints. • Disable flow inbound connectors.
  2. MUnit Testing With Mulesoft • Disable inbound endpoints. • Debug

    the tests. • View coverage reports. • Various asserts available like Assert Equals, Assert Not Equals, Assert Payload, Assert False, Assert True, Assert Null Payload, Assert Not Null Payload. • Spy Message Processor.
  3. MUnit Testing With Mulesoft First thing you want to make

    sure MUnit is installed in your Anypoint Studio. In case, if it is not installed then follow below steps. Go to Help < Install New Software...
  4. MUnit Testing With Mulesoft Now, it will open new pop

    up windows and select MUnit Update Site from drop down list. Check MUnit and MUnit Tools for Mule.
  5. MUnit Testing With Mulesoft Now, it will open new pop

    up windows and select MUnit Update Site from drop down list. Check MUnit and MUnit Tools for Mule. Finally, just click Next and accept the license terms and conditions. Click Finish and it will install MUnit tools in your Anypoint studio.
  6. How to create the MUnit tests for Mule Flow? For

    creating MUnit tests for your application, right click on the flow select MUnit < Create new MUnit.
  7. How to create the MUnit tests for Mule Flow? It

    will create MUnit tests for the flow and it will be available in folder src/test/unit. In Assert Payload, you need to define Expected value and in this case it will be payload. Also, provide Test failure message , in case if value doesn't message expected value then it will provide failure message you have defined.
  8. Run MUnit Tests For running the MUnit tests, right click

    in the canvas region of the MUnit test flow and select Run MUnit suite.
  9. Run MUnit Tests After running the MUnit suite, it will

    be provide details like errors, failures if any, coverage report and test status. In above image, green color means that your test case has been successfully executed and passed.