SlideShare a Scribd company logo
1 of 18
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
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

What's hot

MUnit Testing With Mulesoft-Part I
MUnit Testing With Mulesoft-Part IMUnit Testing With Mulesoft-Part I
MUnit Testing With Mulesoft-Part IJitendra Bafna
 
Mule debugging
Mule   debuggingMule   debugging
Mule debuggingSindhu VL
 
Mulesoft Munit Testing
Mulesoft Munit TestingMulesoft Munit Testing
Mulesoft Munit Testingakshay yeluru
 
JUnit and MUnit Set Up In Anypoint Studio
JUnit and MUnit Set Up In Anypoint StudioJUnit and MUnit Set Up In Anypoint Studio
JUnit and MUnit Set Up In Anypoint StudioSudha Ch
 
Mule soft basic example
Mule soft basic exampleMule soft basic example
Mule soft basic exampleManav Prasad
 
Mule management console installation
Mule management console installation Mule management console installation
Mule management console installation javeed_mhd
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with TomcatSudha Ch
 
JMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaJMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaEdureka!
 
Introduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-TimeIntroduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-TimeBugRaptors
 
Mule soft firstprogram
Mule soft firstprogramMule soft firstprogram
Mule soft firstprogramabhipokharna
 
Integration with CMIS using Mule ESB
Integration with CMIS using Mule ESBIntegration with CMIS using Mule ESB
Integration with CMIS using Mule ESBSanjeet Pandey
 
Jmeter memory profiling, server-side monitoring, memory and cpu monitoring
Jmeter memory profiling, server-side monitoring, memory and cpu monitoringJmeter memory profiling, server-side monitoring, memory and cpu monitoring
Jmeter memory profiling, server-side monitoring, memory and cpu monitoringPankaj Biswas
 
Filter expression in mule
Filter expression in muleFilter expression in mule
Filter expression in muleRajkattamuri
 
MUnit Testing With Mulesoft (Mock Message Processor)-Part II
MUnit Testing With Mulesoft (Mock Message Processor)-Part II MUnit Testing With Mulesoft (Mock Message Processor)-Part II
MUnit Testing With Mulesoft (Mock Message Processor)-Part II Jitendra Bafna
 
How to integrate java application with temenos t24
How to integrate java application with temenos t24How to integrate java application with temenos t24
How to integrate java application with temenos t24Mahmoud Elkholy PMI-ACP
 

What's hot (20)

Mule debugging
Mule debuggingMule debugging
Mule debugging
 
MUnit Testing With Mulesoft-Part I
MUnit Testing With Mulesoft-Part IMUnit Testing With Mulesoft-Part I
MUnit Testing With Mulesoft-Part I
 
Mule debugging
Mule   debuggingMule   debugging
Mule debugging
 
Mulesoft Munit Testing
Mulesoft Munit TestingMulesoft Munit Testing
Mulesoft Munit Testing
 
JUnit and MUnit Set Up In Anypoint Studio
JUnit and MUnit Set Up In Anypoint StudioJUnit and MUnit Set Up In Anypoint Studio
JUnit and MUnit Set Up In Anypoint Studio
 
Mule soft basic example
Mule soft basic exampleMule soft basic example
Mule soft basic example
 
Mule debugging-sample
Mule debugging-sampleMule debugging-sample
Mule debugging-sample
 
Mule management console installation
Mule management console installation Mule management console installation
Mule management console installation
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
 
Les14
Les14Les14
Les14
 
Mule - logger
Mule -  loggerMule -  logger
Mule - logger
 
JMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | EdurekaJMeter vs LoadRunner | Edureka
JMeter vs LoadRunner | Edureka
 
Introduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-TimeIntroduction to jmeter & how to view jmeter Test Result in Real-Time
Introduction to jmeter & how to view jmeter Test Result in Real-Time
 
Mule soft firstprogram
Mule soft firstprogramMule soft firstprogram
Mule soft firstprogram
 
Integration with CMIS using Mule ESB
Integration with CMIS using Mule ESBIntegration with CMIS using Mule ESB
Integration with CMIS using Mule ESB
 
Mule security
Mule securityMule security
Mule security
 
Jmeter memory profiling, server-side monitoring, memory and cpu monitoring
Jmeter memory profiling, server-side monitoring, memory and cpu monitoringJmeter memory profiling, server-side monitoring, memory and cpu monitoring
Jmeter memory profiling, server-side monitoring, memory and cpu monitoring
 
Filter expression in mule
Filter expression in muleFilter expression in mule
Filter expression in mule
 
MUnit Testing With Mulesoft (Mock Message Processor)-Part II
MUnit Testing With Mulesoft (Mock Message Processor)-Part II MUnit Testing With Mulesoft (Mock Message Processor)-Part II
MUnit Testing With Mulesoft (Mock Message Processor)-Part II
 
How to integrate java application with temenos t24
How to integrate java application with temenos t24How to integrate java application with temenos t24
How to integrate java application with temenos t24
 

Similar to MUnit - Introduction

MUnit - Testing Mule
MUnit - Testing MuleMUnit - Testing Mule
MUnit - Testing MuleShanky Gupta
 
MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020DianeKesler1
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosFlutter Agency
 
Munit In Mule 4 | Patna MuleSoft Meetup #26
Munit In Mule 4 | Patna MuleSoft Meetup #26Munit In Mule 4 | Patna MuleSoft Meetup #26
Munit In Mule 4 | Patna MuleSoft Meetup #26shyamraj55
 
Getting started with_testcomplete
Getting started with_testcompleteGetting started with_testcomplete
Getting started with_testcompleteankit.das
 
An Overview of User Acceptance Testing (UAT)
An Overview of User Acceptance Testing (UAT)An Overview of User Acceptance Testing (UAT)
An Overview of User Acceptance Testing (UAT)Usersnap
 
Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfKaty Slemon
 
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftEngineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftJitendra Bafna
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XAmit Singh
 
QTP with Descriptive programming
QTP with Descriptive programmingQTP with Descriptive programming
QTP with Descriptive programmingKuldeep Sharma
 
Qtp with descriptive programming
Qtp with descriptive programmingQtp with descriptive programming
Qtp with descriptive programmingmedsherb
 
Qtp With Descriptive Programming
Qtp With Descriptive ProgrammingQtp With Descriptive Programming
Qtp With Descriptive ProgrammingKuldeep Sharma
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorialsmedsherb
 
Stresstimulus Load Testing Tool Getting Started
Stresstimulus Load Testing Tool Getting StartedStresstimulus Load Testing Tool Getting Started
Stresstimulus Load Testing Tool Getting Startedstresstimulus
 
Getting started with test complete 7
Getting started with test complete 7Getting started with test complete 7
Getting started with test complete 7Hoamuoigio Hoa
 
Module 3.8 application testing.ppt
Module 3.8 application testing.pptModule 3.8 application testing.ppt
Module 3.8 application testing.pptssuserd973fe
 

Similar to MUnit - Introduction (20)

Introduction to munit
Introduction to munitIntroduction to munit
Introduction to munit
 
MUnit - Testing Mule
MUnit - Testing MuleMUnit - Testing Mule
MUnit - Testing Mule
 
Munit
MunitMunit
Munit
 
MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020
 
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex ScenariosUnit Testing in Flutter - From Workflow Essentials to Complex Scenarios
Unit Testing in Flutter - From Workflow Essentials to Complex Scenarios
 
Munit In Mule 4 | Patna MuleSoft Meetup #26
Munit In Mule 4 | Patna MuleSoft Meetup #26Munit In Mule 4 | Patna MuleSoft Meetup #26
Munit In Mule 4 | Patna MuleSoft Meetup #26
 
Getting started with_testcomplete
Getting started with_testcompleteGetting started with_testcomplete
Getting started with_testcomplete
 
An Overview of User Acceptance Testing (UAT)
An Overview of User Acceptance Testing (UAT)An Overview of User Acceptance Testing (UAT)
An Overview of User Acceptance Testing (UAT)
 
Unit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdfUnit Testing Using Mockito in Android (1).pdf
Unit Testing Using Mockito in Android (1).pdf
 
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoftEngineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.X
 
QTP with Descriptive programming
QTP with Descriptive programmingQTP with Descriptive programming
QTP with Descriptive programming
 
Qtp with descriptive programming
Qtp with descriptive programmingQtp with descriptive programming
Qtp with descriptive programming
 
Qtp With Descriptive Programming
Qtp With Descriptive ProgrammingQtp With Descriptive Programming
Qtp With Descriptive Programming
 
QTP 9.2
QTP 9.2QTP 9.2
QTP 9.2
 
Qtp 9.2 tutorials
Qtp 9.2 tutorialsQtp 9.2 tutorials
Qtp 9.2 tutorials
 
Combined Project
Combined ProjectCombined Project
Combined Project
 
Stresstimulus Load Testing Tool Getting Started
Stresstimulus Load Testing Tool Getting StartedStresstimulus Load Testing Tool Getting Started
Stresstimulus Load Testing Tool Getting Started
 
Getting started with test complete 7
Getting started with test complete 7Getting started with test complete 7
Getting started with test complete 7
 
Module 3.8 application testing.ppt
Module 3.8 application testing.pptModule 3.8 application testing.ppt
Module 3.8 application testing.ppt
 

Recently uploaded

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查ydyuyu
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样ayvbos
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtrahman018755
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxgalaxypingy
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirtrahman018755
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrHenryBriggs2
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptxAsmae Rabhi
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查ydyuyu
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasDigicorns Technologies
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsMonica Sydney
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge GraphsEleniIlkou
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdfMatthew Sinclair
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsMonica Sydney
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdfMatthew Sinclair
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdfMatthew Sinclair
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdfMatthew Sinclair
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制pxcywzqs
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Roommeghakumariji156
 

Recently uploaded (20)

哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
一比一原版(Curtin毕业证书)科廷大学毕业证原件一模一样
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
Trump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts SweatshirtTrump Diapers Over Dems t shirts Sweatshirt
Trump Diapers Over Dems t shirts Sweatshirt
 
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
2nd Solid Symposium: Solid Pods vs Personal Knowledge Graphs
 
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
20240507 QFM013 Machine Intelligence Reading List April 2024.pdf
 
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girlsRussian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
Russian Call girls in Abu Dhabi 0508644382 Abu Dhabi Call girls
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
一比一原版(Offer)康考迪亚大学毕业证学位证靠谱定制
 
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac RoomVip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
Vip Firozabad Phone 8250092165 Escorts Service At 6k To 30k Along With Ac Room
 

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
  • 8.
  • 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