MUnit
Introduction into
Automated Testing of Apps
In Anypoint Studio
Test my apps? Why would I?
Tests should be applied during each phase of the
software development process from
developer tests to acceptance tests.
In software engineering comprehensive and
automated test suits will secure the quality of
software and can provide a safety net for
regression and incompatibility changes.
The Testing Pyramid
Ideally testing of software projects is built bottom up.
Starting with a large test case base of automated unit
tests for the smallest components which make up the
whole application together.
Going up through architecture layers the number of test
cases decreases for larger components because they
are compositions of the already tested components.
Reaching finally the top of the pyramid where manual
supervision or manual tests make up the top of the
pyramid testing the application as a whole
*http://martinfowler.com/bliki/TestPyramid.html
*http://watirmelon.com/2012/01/31/introducing-the-software-
testing-ice-cream-cone/
Unit Tests
On the lowest level unit tests verify the
correct functionality of classes. These classes can be
in a Mule project simple extensions and
customizations of the Mule framework. Unit tests in
a classical sense can test the functionality of custom
classes without firing up Mule.
Single Unit
* https://blog.codecentric.de/en/2015/01/mule-esb-testing-part-13-unit-functional-testing/
Functional Tests
When it comes to testing the interaction of
components between each other in sub flows
or “simple” flows functional tests are the
recommended way of testing.
Single Unit Single UnitSingle Unit
* https://blog.codecentric.de/en/2015/01/mule-esb-testing-part-13-unit-functional-testing/
What is MUnit ?
MUnit is a Mule testing framework which allows
Mule developers to easily automate testing. It
is an open-source project, created originally as
a side project in Mule.
* https://developer.mulesoft.com/docs/display/current/MUnit
Munit will allow you to:
Create your Mule test by writing
Mule code.
Create your Mule test by writing
Java code.
Disable flow inbound endpoints.
Disable endpoint connectors.
Mock outbound endpoints.
Mock message processors.
Spy any message processor.
Verify message processor calls
Create not only unit tests but
also integration tests in a local
environment .
MUnit allows you to start a
local FTP/SFTP, DB server or mail
server.
Call the Mule client from Mule
code.
Assert flow exceptions.
Enable or disable particular
tests.
See assertion/error reports with
Mule stack trace.
Extend the MUnit framework
with plugins.
Check visual coverage in Studio.
Debug your tests with Studio.
* https://developer.mulesoft.com/docs/display/current/MUnit
MUnit - Introduction
Installing MUnit
To install MUnit, follow these steps:
Verify that your version of Studio is 5.2.0 (July 2015 release) or
above.
Add the MUnit update site:
http://studio.mulesoft.org/r4/munit
Go to Help -> Install New Software.
Studio displays the Available Software window. In the Work with:
field, paste the MUnit update site
Check Munit and Munit Tools for Mule.
Using MUnit automatically adds a new folder, src/test/munit, to
your project.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Creating a New MUnit Test in Studio
MUnit Studio integration is mainly built around XML-
based tests. Most of the MUnit-Studio integration tools
guide you in the creation of these tests.
There are two basic ways to create a new MUnit test in
Studio:
1. Right-click a specific flow by right clicking the flow and
selecting MUnit
2. Use the wizard, which allows you to create a test for any
flow or application in the workspace
The most basic ones are by right-clicking the flow you
want to test, or by using the wizard.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Creating a Test for a Specific Flow
To create a test for a specific flow, right-click the flow, then
select:
MUnit -> Create a new <flow_name> suite
This Creates a new test suite named after the XML file
where the flow resides, in this case munit2.xml. Studio
displays the test suite on a new tab, next to the tab for the
original application, imports the XML file to the test suite
and creates a new MUnit test.
To add an MUnit message processor to the test as
described above, drag it from the Palette to the Test area
after the flow-ref.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
This creates the following XML:
<?xml version="1.0" encoding="UTF-8"?>
<mule xmlns="http://www.mulesoft.org/schema/mule/core"
xmlns:munit="http://www.mulesoft.org/schema/mule/munit"
xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
xmlns:spring="http://www.springframework.org/schema/beans"
xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit
http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core
http://www.mulesoft.org/schema/mule/core/current/mule.xsd">
<munit:config name="munit" doc:name="MUnit configuration"/>
<spring:beans>
<spring:import resource="classpath:munit2.xml"/>
</spring:beans>
<munit:test name="munit2-test-suite-munit2FlowTest" description="Test">
<flow-ref name="munit2Flow" doc:name="Flow-ref to munit2Flow"/>
</munit:test>
</mule>
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Creating a Test Via the Wizard
The wizard allows you to create a test for any flow or
application in your Studio workspace.
To create a test via the wizard, go to File -> New -> MUnit
Test. Now Studio displays the MUnit test creation wizard.
As you can see, the wizard allows you to select any of the
flows and applications in the workspace.
If you want to create a test that does not reference a
specific flow, click the Create empty test checkbox.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Configuring Your Test
Studio displays the newly-created test suite in
its own canvas. Here you can tailor your test
suite using the Studio interface, just like a
regular application.
The Studio Palette displays two new
sections: MUnit and MUnit Integration Test
Tools. To quickly see all MUnit message
processors, type munit in the Palette search
filter.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Running Your Test
Running a Test Suite
To run a test suite, right-click the empty canvas where the suite resides,
then select Run MUnit suite. Studio displays the output from the running
suite in the console.
Running a Test
To run a test, right-click the name of the test, then select Run MUnit
Test.
To check that the test is actually running, view the output in the
console. In order not to overwhelm the user, the default output
provides little information, but enough to verify that the test has
run.
An alternative way to run a test is to use the MUnit tab.
1. Select the desired test in the MUnit tab.
2. Right-click the test, then select Run.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Viewing Test Results
Studio displays MUnit test results in the MUnit tab of the left-hand explorer pane. The MUnit
tab displays successful tests in green, failed tests in red.
The Coverage button allows you to see what flow the test covered, and the percentage of
message processors in the flow that was covered by the test.
If you run more than one test, the MUnit tab displays a history of run tests. For failed tests,
the Errors button displays the stack trace, which you can copy to your clipboard. To copy the
stacktrace, right-click the name of the failed test, then select Copy Stack Trace.
As you can see in the image above, you can also use the MUnit tab to run or debug your test,
by selecting the appropriate menu option.
Clicking the debug button or the play button on the top right causes the last run or debug to
be re-run. This re-run includes all tests that were run on the previous run. You can also select
a single test from the previous run to re-run on its own.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
Debugging Tests
You can debug MUnit tests just like Studio applications, using Studio's debugging perspective.
To access the debugging perspective, click Mule Debug on the top right of the Studio toolbar.
This takes you away from the default Mule Design perspective to the debugging perspective,
which displays debugging controls.
As with Mule applications, you can mark an MUnit message processor as a breakpoint, where
a debug run should stop to enable you to see the information that reaches the message
processor.
To debug a test, you can:
– Right-click the test in the canvas, then select Debug MUnit test.
– If you are working in the MUnit tab, you can select a test that previously ran, then click
the debug icon on the top right.
– Or right-click the desired test, then select Debug.
* https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
The End

More Related Content

PPTX
Mule soft munit test
PDF
Munit Mule ESB
PPTX
Mocking with salesforce using Munit
PPTX
MuleSoft ESB Testing Mule Application using MUnit Test Suite
PPTX
Munit junit test case
PPTX
Debugging mule
PPTX
Testing in mule
PPTX
Mule m unit
Mule soft munit test
Munit Mule ESB
Mocking with salesforce using Munit
MuleSoft ESB Testing Mule Application using MUnit Test Suite
Munit junit test case
Debugging mule
Testing in mule
Mule m unit

What's hot (20)

PPTX
Mule debugging
PDF
MUnit Testing With Mulesoft-Part I
PPTX
Mule debugging
PDF
Mulesoft Munit Testing
PPTX
JUnit and MUnit Set Up In Anypoint Studio
PPTX
Mule soft basic example
PPTX
Mule debugging-sample
PPTX
Mule management console installation
PPTX
Mule management console installation with Tomcat
PPT
PPT
Mule - logger
PDF
JMeter vs LoadRunner | Edureka
PPTX
Introduction to jmeter & how to view jmeter Test Result in Real-Time
PPT
Mule soft firstprogram
PPTX
Integration with CMIS using Mule ESB
PPT
Mule security
PDF
Jmeter memory profiling, server-side monitoring, memory and cpu monitoring
PPTX
Filter expression in mule
PDF
MUnit Testing With Mulesoft (Mock Message Processor)-Part II
DOCX
How to integrate java application with temenos t24
Mule debugging
MUnit Testing With Mulesoft-Part I
Mule debugging
Mulesoft Munit Testing
JUnit and MUnit Set Up In Anypoint Studio
Mule soft basic example
Mule debugging-sample
Mule management console installation
Mule management console installation with Tomcat
Mule - logger
JMeter vs LoadRunner | Edureka
Introduction to jmeter & how to view jmeter Test Result in Real-Time
Mule soft firstprogram
Integration with CMIS using Mule ESB
Mule security
Jmeter memory profiling, server-side monitoring, memory and cpu monitoring
Filter expression in mule
MUnit Testing With Mulesoft (Mock Message Processor)-Part II
How to integrate java application with temenos t24
Ad

Similar to MUnit - Introduction (20)

PPTX
Mule Testing in Mulesfoft 4.X
PPTX
MUnit - Testing Mule
PPTX
Introduction to munit
PPTX
Munit
PDF
MuleSoft MUnit Test Recorder Meetup
PDF
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
PDF
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
PDF
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
PDF
Mule soft meetup_tw_no1_june17
PPTX
#9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx
PPTX
#9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx
PDF
Mule soft meetup_hk_june2020
PPTX
Testing mule
PPTX
Mule testing
PPTX
Mexico City Online Mulesoft Meetup - Quality Code with MUNIT - May 4, 2020
PDF
Munit In Mule 4 | Patna MuleSoft Meetup #26
ODP
Mule esb munit
PPTX
Introduction testingmule
PDF
Testing strategies and best practices using MUnit
PPTX
Introduction to testing mule
Mule Testing in Mulesfoft 4.X
MUnit - Testing Mule
Introduction to munit
Munit
MuleSoft MUnit Test Recorder Meetup
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Mule soft meetup_tw_no1_june17
#9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx
#9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx
Mule soft meetup_hk_june2020
Testing mule
Mule testing
Mexico City Online Mulesoft Meetup - Quality Code with MUNIT - May 4, 2020
Munit In Mule 4 | Patna MuleSoft Meetup #26
Mule esb munit
Introduction testingmule
Testing strategies and best practices using MUnit
Introduction to testing mule
Ad

Recently uploaded (20)

PDF
Exploring The Internet Of Things(IOT).ppt
PPTX
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
PPTX
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
PDF
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
PPTX
TITLE DEFENSE entitle the impact of social media on education
PPT
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
PDF
Uptota Investor Deck - Where Africa Meets Blockchain
PPTX
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes
DOCX
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
PDF
Understand the Gitlab_presentation_task.pdf
PPT
12 Things That Make People Trust a Website Instantly
PPTX
artificialintelligenceai1-copy-210604123353.pptx
PDF
Exploring VPS Hosting Trends for SMBs in 2025
PDF
Containerization lab dddddddddddddddmanual.pdf
PDF
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
PDF
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
PDF
simpleintnettestmetiaerl for the simple testint
PDF
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
PPTX
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
PPTX
The-Importance-of-School-Sanitation.pptx
Exploring The Internet Of Things(IOT).ppt
1402_iCSC_-_RESTful_Web_APIs_--_Josef_Hammer.pptx
IPCNA VIRTUAL CLASSES INTERMEDIATE 6 PROJECT.pptx
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
TITLE DEFENSE entitle the impact of social media on education
FIRE PREVENTION AND CONTROL PLAN- LUS.FM.MQ.OM.UTM.PLN.00014.ppt
Uptota Investor Deck - Where Africa Meets Blockchain
Top Website Bugs That Hurt User Experience – And How Expert Web Design Fixes
Powerful Ways AIRCONNECT INFOSYSTEMS Pvt Ltd Enhances IT Infrastructure in In...
Understand the Gitlab_presentation_task.pdf
12 Things That Make People Trust a Website Instantly
artificialintelligenceai1-copy-210604123353.pptx
Exploring VPS Hosting Trends for SMBs in 2025
Containerization lab dddddddddddddddmanual.pdf
Session 1 (Week 1)fghjmgfdsfgthyjkhfdsadfghjkhgfdsa
The Ikigai Template _ Recalibrate How You Spend Your Time.pdf
simpleintnettestmetiaerl for the simple testint
📍 LABUAN4D EXCLUSIVE SERVER STAR GAMING ASIA NO.1 TERPOPULER DI INDONESIA ! 🌟
KSS ON CYBERSECURITY INCIDENT RESPONSE AND PLANNING MANAGEMENT.pptx
The-Importance-of-School-Sanitation.pptx

MUnit - Introduction

  • 1. MUnit Introduction into Automated Testing of Apps In Anypoint Studio
  • 2. Test my apps? Why would I? Tests should be applied during each phase of the software development process from developer tests to acceptance tests. In software engineering comprehensive and automated test suits will secure the quality of software and can provide a safety net for regression and incompatibility changes.
  • 3. The Testing Pyramid Ideally testing of software projects is built bottom up. Starting with a large test case base of automated unit tests for the smallest components which make up the whole application together. Going up through architecture layers the number of test cases decreases for larger components because they are compositions of the already tested components. Reaching finally the top of the pyramid where manual supervision or manual tests make up the top of the pyramid testing the application as a whole *http://martinfowler.com/bliki/TestPyramid.html *http://watirmelon.com/2012/01/31/introducing-the-software- testing-ice-cream-cone/
  • 4. Unit Tests On the lowest level unit tests verify the correct functionality of classes. These classes can be in a Mule project simple extensions and customizations of the Mule framework. Unit tests in a classical sense can test the functionality of custom classes without firing up Mule. Single Unit * https://blog.codecentric.de/en/2015/01/mule-esb-testing-part-13-unit-functional-testing/
  • 5. Functional Tests When it comes to testing the interaction of components between each other in sub flows or “simple” flows functional tests are the recommended way of testing. Single Unit Single UnitSingle Unit * https://blog.codecentric.de/en/2015/01/mule-esb-testing-part-13-unit-functional-testing/
  • 6. What is MUnit ? MUnit is a Mule testing framework which allows Mule developers to easily automate testing. It is an open-source project, created originally as a side project in Mule. * https://developer.mulesoft.com/docs/display/current/MUnit
  • 7. Munit will allow you to: Create your Mule test by writing Mule code. Create your Mule test by writing Java code. Disable flow inbound endpoints. Disable endpoint connectors. Mock outbound endpoints. Mock message processors. Spy any message processor. Verify message processor calls Create not only unit tests but also integration tests in a local environment . MUnit allows you to start a local FTP/SFTP, DB server or mail server. Call the Mule client from Mule code. Assert flow exceptions. Enable or disable particular tests. See assertion/error reports with Mule stack trace. Extend the MUnit framework with plugins. Check visual coverage in Studio. Debug your tests with Studio. * https://developer.mulesoft.com/docs/display/current/MUnit
  • 9. Installing MUnit To install MUnit, follow these steps: Verify that your version of Studio is 5.2.0 (July 2015 release) or above. Add the MUnit update site: http://studio.mulesoft.org/r4/munit Go to Help -> Install New Software. Studio displays the Available Software window. In the Work with: field, paste the MUnit update site Check Munit and Munit Tools for Mule. Using MUnit automatically adds a new folder, src/test/munit, to your project. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 10. Creating a New MUnit Test in Studio MUnit Studio integration is mainly built around XML- based tests. Most of the MUnit-Studio integration tools guide you in the creation of these tests. There are two basic ways to create a new MUnit test in Studio: 1. Right-click a specific flow by right clicking the flow and selecting MUnit 2. Use the wizard, which allows you to create a test for any flow or application in the workspace The most basic ones are by right-clicking the flow you want to test, or by using the wizard. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 11. Creating a Test for a Specific Flow To create a test for a specific flow, right-click the flow, then select: MUnit -> Create a new <flow_name> suite This Creates a new test suite named after the XML file where the flow resides, in this case munit2.xml. Studio displays the test suite on a new tab, next to the tab for the original application, imports the XML file to the test suite and creates a new MUnit test. To add an MUnit message processor to the test as described above, drag it from the Palette to the Test area after the flow-ref. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 12. This creates the following XML: <?xml version="1.0" encoding="UTF-8"?> <mule xmlns="http://www.mulesoft.org/schema/mule/core" xmlns:munit="http://www.mulesoft.org/schema/mule/munit" xmlns:doc="http://www.mulesoft.org/schema/mule/documentation" xmlns:spring="http://www.springframework.org/schema/beans" xmlns:core="http://www.mulesoft.org/schema/mule/core" version="EE-3.7.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd"> <munit:config name="munit" doc:name="MUnit configuration"/> <spring:beans> <spring:import resource="classpath:munit2.xml"/> </spring:beans> <munit:test name="munit2-test-suite-munit2FlowTest" description="Test"> <flow-ref name="munit2Flow" doc:name="Flow-ref to munit2Flow"/> </munit:test> </mule> * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 13. Creating a Test Via the Wizard The wizard allows you to create a test for any flow or application in your Studio workspace. To create a test via the wizard, go to File -> New -> MUnit Test. Now Studio displays the MUnit test creation wizard. As you can see, the wizard allows you to select any of the flows and applications in the workspace. If you want to create a test that does not reference a specific flow, click the Create empty test checkbox. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 14. Configuring Your Test Studio displays the newly-created test suite in its own canvas. Here you can tailor your test suite using the Studio interface, just like a regular application. The Studio Palette displays two new sections: MUnit and MUnit Integration Test Tools. To quickly see all MUnit message processors, type munit in the Palette search filter. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 15. Running Your Test Running a Test Suite To run a test suite, right-click the empty canvas where the suite resides, then select Run MUnit suite. Studio displays the output from the running suite in the console. Running a Test To run a test, right-click the name of the test, then select Run MUnit Test. To check that the test is actually running, view the output in the console. In order not to overwhelm the user, the default output provides little information, but enough to verify that the test has run. An alternative way to run a test is to use the MUnit tab. 1. Select the desired test in the MUnit tab. 2. Right-click the test, then select Run. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 16. Viewing Test Results Studio displays MUnit test results in the MUnit tab of the left-hand explorer pane. The MUnit tab displays successful tests in green, failed tests in red. The Coverage button allows you to see what flow the test covered, and the percentage of message processors in the flow that was covered by the test. If you run more than one test, the MUnit tab displays a history of run tests. For failed tests, the Errors button displays the stack trace, which you can copy to your clipboard. To copy the stacktrace, right-click the name of the failed test, then select Copy Stack Trace. As you can see in the image above, you can also use the MUnit tab to run or debug your test, by selecting the appropriate menu option. Clicking the debug button or the play button on the top right causes the last run or debug to be re-run. This re-run includes all tests that were run on the previous run. You can also select a single test from the previous run to re-run on its own. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio
  • 17. Debugging Tests You can debug MUnit tests just like Studio applications, using Studio's debugging perspective. To access the debugging perspective, click Mule Debug on the top right of the Studio toolbar. This takes you away from the default Mule Design perspective to the debugging perspective, which displays debugging controls. As with Mule applications, you can mark an MUnit message processor as a breakpoint, where a debug run should stop to enable you to see the information that reaches the message processor. To debug a test, you can: – Right-click the test in the canvas, then select Debug MUnit test. – If you are working in the MUnit tab, you can select a test that previously ran, then click the debug icon on the top right. – Or right-click the desired test, then select Debug. * https://developer.mulesoft.com/docs/display/current/Using+MUnit+in+Anypoint+Studio