SlideShare a Scribd company logo
03rd June 2023
Calicut MuleSoft Meetup Group
#9 MUnit in Mule 4
Safe Harbour Statement
● Both the speaker and the host are organizing this meet-up in individual capacity only. We are
not representing our companies here.
● This presentation is strictly for learning purposes only. Organizer/Presenter do not hold any
responsibility that same solution will work for your business requirements.
● This presentation is not meant for any promotional activities.
2
A recording of this meetup will be uploaded to events page within 24 hours.
Questions can be submitted/asked at any time in the Chat/Questions & Answers Tab.
Make it more Interactive!!!
Give us feedback! Rate this meetup session by filling feedback form at the end of the day.
We Love Feedbacks!!! Its Bread & Butter for Meetup.
Housekeeping
3
Organizers
Fathima Farzana
NJC Labs
MuleSoft / Integration Developer
John Mathew Philip
NJC Labs
MuleSoft / Integration Developer
Anoop Ramachandran
NJC Labs
Technical Instructor / Integration Architect
https://www.linkedin.com/feed/update/urn:li:activity:7069907733281406977/
✔ MuleSoft Ambassador
✔ MuleSoft Meetup Speaker
✔ Guwahati & Lucknow Meetup Leader
✔ Certified MuleSoft Developer & Architect
✔ Total 8 years of experience (6 in MuleSoft)
✔ Working as Associate Solution Architect at Apisero Inc.
Abhishek Bathwal
Apisero Inc
Associate Solution Architect
● About the Speaker
Introduction
linkedin.com/in/abhishek-bathwal-
49360694
youtube.com/@abhishekbathwal1805
youtube.com/@developersguide5562 6
7
Agenda
Introduction To
Munit
Different
Approach of
Writing Munit
Limitations of
Test Recorder
Munit Tools and
Components
Executing Munit
Suits
Munit Coverage
Live
Demonstration
What is Munit?
9
MUnit is Anypoint Platform’s dedicated unit testing tool specifically designed for Mule applications. It
runs inside a Mule runtime, manually in Anypoint Studio, and automatically as part of the Maven-based
CI/CD build process. MUnit is designed to create structural test cases as Mule flows. That means you
can use components on top of MUnit and MUnit tool modules.
What is Munit?
10
Different Approach of Writing Munit
● Munit Test Recorder
● Manually
11
Limitations with Test Recorder
The test recorder is limited in the following ways when you create MUnit tests:
● You cannot create tests for flows with Mule errors raised inside the flow or already
existing in the incoming event, not even if they are handled by an on error continue error
handler.
● A recorded flow execution ends successfully, but the result does not reach its
destination because the application is killed.
● Your validations fail every time your test runs if you configure Spy or Assert processors
to assert values for random data, time-dependent information (such as timestamps), or
values resulting from parallel processes, because those values change in every
execution.
● Mocking values resulting from parallel processes causes a mixture of real and mocked
data that compromises the execution of the processors that follow in your test.
● Although the recorder supports data iteration in the flow, such as recursivity or loops, it
does not support cases in which the structure of the data being tested changes inside
the iteration.
● The recorder does not support mocking a message before or inside a Foreach
12
● Test
● Mock When
● Set Event
● Asset That
● Assert Equal
● Asset Expression
● Verify Call
● Spy
Munit Tools and Components
13
Executing Munit Suite
● From Studio
● From cmd (mvn clean test)
14
Munit Coverage
The MUnit Coverage feature provides a measurement of how much of a Mule application has been
executed by a set of MUnit tests by counting the amount of event processors executed.This allows
you to obtain a quality standard for your application, and provides metrics for:
● Application overall coverage: An average of the items below.
● Resource coverage: Refers to each Mule configuration file under src/main/mule.
● Flow coverage: Refers to any of the following components: Flows, Sub-flows, and Batch jobs.
15
● <ignoreFlows>
<ignoreFlow>FlowName</ignoreFlow>
</ignoreFlows>
● <ignoreFiles>
<ignoreFile>FileNamet.xml</ignoreFile>
</ignoreFiles>
Ignoring Files or Flow
Munit for Batch
Processing
Batch Processing
Mule batch processing components are designed for reliable, asynchronous processing of larger-than-
memory data sets. The components are the Batch Job, Batch Step, and Batch Aggregator. The Batch
Job component automatically splits source data and stores it into persistent queues, which makes it
possible to process large data sets while providing reliability. In the event that the application is re-
deployed or Mule crashes, the job execution is able to resume at the point it stopped.
17
Phases:
● Load and Dispatch
● Process
● On Complete
MUnit for Batch
18
Demo
20
● https://docs.mulesoft.com/mule-runtime/3.6/munit
● https://docs.mulesoft.com/munit/2.3/test-recorder
● https://blogs.mulesoft.com/dev-guides/how-to-tutorials/munit-testing-strategies/
● https://dzone.com/articles/mock-apikitrouter-and-write-munit-test-cases-for-d
● https://youtu.be/iLTqZ_ZcdEs
● https://docs.mulesoft.com/mule-runtime/4.4/batch-processing-concept
● https://javastreets.com/blog/2017/9/mule-batch-processing-part1-introduction.html
● https://billennium.com/blog/munit-for-batch-module-in-mule-4/
Reference
Q&A
Take a stand !
22
●Nominate yourself for the next meetup speaker and suggest a topic as well.
23
● Share:
○ Tweet using the hashtag #MuleSoftMeetups
○ Invite your network to join: https://meetups.mulesoft.com/calicut/
● Feedback:
○ Fill out the survey feedback and suggest topics for upcoming events
○ Contact MuleSoft at meetups@mulesoft.com for ways to improve the program
What’s next?
Thank You

More Related Content

PDF
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
Jitendra Bafna
 
PPTX
Mule soft meetup__adelaide_october_2020_final (2)
Nicholas Bowman
 
PDF
Mule Meetup Hyderabad - Aug 2020
Sravan Lingam
 
PDF
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Jitendra Bafna
 
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
PPTX
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
PDF
Manila MuleSoft Meetup - August 2020
Ryan Anthony Andal
 
PPTX
Princeton-NJ-Meetup-MuleSoft SumoLogic Integration.pptx
SubhasRoy11
 
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
Jitendra Bafna
 
Mule soft meetup__adelaide_october_2020_final (2)
Nicholas Bowman
 
Mule Meetup Hyderabad - Aug 2020
Sravan Lingam
 
Engineering Student MuleSoft Meetup#4 - API Testing With MuleSoft
Jitendra Bafna
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
Ahmadabad mule soft_meetup_11_october_2020_errorhanlingandmonitoringalerts
Shekh Muenuddeen
 
Manila MuleSoft Meetup - August 2020
Ryan Anthony Andal
 
Princeton-NJ-Meetup-MuleSoft SumoLogic Integration.pptx
SubhasRoy11
 

Similar to #9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx (20)

PPTX
MuleSoft Meetup | Reading Meetup Group | Hosted by Integral Zone
IntegralZone
 
PPTX
MuleSoft Kochi Meetup #5– Handling Mule Exceptions
sumitahuja94
 
PDF
Testing strategies and best practices using MUnit
Jimmy Attia
 
PPTX
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
MulesoftMunichMeetup
 
PPTX
Princeton-NJ-Meetup-Troubleshooting-with-AnyPoint-Monitoring
Sravan Lingam
 
PPTX
Vancouver mulesoft meetup_23-july
Vikalp Bhalia
 
PDF
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Alexandra N. Martinez
 
PDF
Mule soft meetup_th_no1
WendyTey4
 
PPTX
Mule Testing in Mulesfoft 4.X
Amit Singh
 
DOCX
Concurrency : Mutual Exclusion and Synchronization
Guna Dhondwad
 
PDF
MuleSoft Surat Meetup#47 - Error Handling With MuleSoft
Jitendra Bafna
 
PDF
Mule soft meetup_tw_no1_june17
WendyTey4
 
PDF
MuleSoft Surat Virtual Meetup#37 - Anypoint Monitoring On Premise
Jitendra Bafna
 
PDF
MuleSoft Surat Meetup#40 - Watermarking Concept and Fragments in MuleSoft
Jitendra Bafna
 
PPTX
27th Hyderabad MuleSoft Meetup
MuleSoft Meetups
 
PPTX
API LifeCycle Management
MuleSoft Meetups
 
PPTX
Online Spanish meetup #1
Alexandra N. Martinez
 
PDF
MuleSoft Singapore Meetup May 2020
Julian Douch
 
PDF
Sydney mule soft meetup 30 april 2020
Royston Lobo
 
PPTX
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
shyamraj55
 
MuleSoft Meetup | Reading Meetup Group | Hosted by Integral Zone
IntegralZone
 
MuleSoft Kochi Meetup #5– Handling Mule Exceptions
sumitahuja94
 
Testing strategies and best practices using MUnit
Jimmy Attia
 
Anypoint Code Builder - Munich MuleSoft Meetup - 16th May 2024
MulesoftMunichMeetup
 
Princeton-NJ-Meetup-Troubleshooting-with-AnyPoint-Monitoring
Sravan Lingam
 
Vancouver mulesoft meetup_23-july
Vikalp Bhalia
 
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Alexandra N. Martinez
 
Mule soft meetup_th_no1
WendyTey4
 
Mule Testing in Mulesfoft 4.X
Amit Singh
 
Concurrency : Mutual Exclusion and Synchronization
Guna Dhondwad
 
MuleSoft Surat Meetup#47 - Error Handling With MuleSoft
Jitendra Bafna
 
Mule soft meetup_tw_no1_june17
WendyTey4
 
MuleSoft Surat Virtual Meetup#37 - Anypoint Monitoring On Premise
Jitendra Bafna
 
MuleSoft Surat Meetup#40 - Watermarking Concept and Fragments in MuleSoft
Jitendra Bafna
 
27th Hyderabad MuleSoft Meetup
MuleSoft Meetups
 
API LifeCycle Management
MuleSoft Meetups
 
Online Spanish meetup #1
Alexandra N. Martinez
 
MuleSoft Singapore Meetup May 2020
Julian Douch
 
Sydney mule soft meetup 30 april 2020
Royston Lobo
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
shyamraj55
 
Ad

More from JohnMathewPhilip (6)

PPTX
#6 Calicut MuleSoft Meetup : Demystyfying Custom Policies in Mule
JohnMathewPhilip
 
PPTX
#5-Calicut-MuleSoft-Meetup-User-Management-in-AnypointPlatform
JohnMathewPhilip
 
PPTX
#4 Calicut MuleSoft Meetup - Message Resequencing in Mule
JohnMathewPhilip
 
PPTX
#3 calicut meetup - understanding slb, dlb and web sockets
JohnMathewPhilip
 
PPTX
#2 connected apps_calicut_31_july
JohnMathewPhilip
 
PPTX
#1 Calicut MuleSoft Meetup - Introduction to Enterprise Integration and MuleSoft
JohnMathewPhilip
 
#6 Calicut MuleSoft Meetup : Demystyfying Custom Policies in Mule
JohnMathewPhilip
 
#5-Calicut-MuleSoft-Meetup-User-Management-in-AnypointPlatform
JohnMathewPhilip
 
#4 Calicut MuleSoft Meetup - Message Resequencing in Mule
JohnMathewPhilip
 
#3 calicut meetup - understanding slb, dlb and web sockets
JohnMathewPhilip
 
#2 connected apps_calicut_31_july
JohnMathewPhilip
 
#1 Calicut MuleSoft Meetup - Introduction to Enterprise Integration and MuleSoft
JohnMathewPhilip
 
Ad

Recently uploaded (20)

PPTX
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
PDF
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
CIFDAQ
 
PDF
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
AbdullahSani29
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PDF
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
PDF
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
PDF
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
PPTX
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
PDF
Orbitly Pitch DeckA Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Shreyas_Phanse_Resume: Experienced Backend Engineer | Java ‱ Spring Boot ‱ Ka...
SHREYAS PHANSE
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
PDF
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PPTX
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
DOCX
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 
Smart Infrastructure and Automation through IoT Sensors
Rejig Digital
 
CIFDAQ's Teaching Thursday: Moving Averages Made Simple
CIFDAQ
 
Revolutionize Operations with Intelligent IoT Monitoring and Control
Rejig Digital
 
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
AVTRON Technologies LLC
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
AbdullahSani29
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
madgavkar20181017ppt McKinsey Presentation.pdf
georgschmitzdoerner
 
The Evolution of KM Roles (Presented at Knowledge Summit Dublin 2025)
Enterprise Knowledge
 
NewMind AI Monthly Chronicles - July 2025
NewMind AI
 
How to Build a Scalable Micro-Investing Platform in 2025 - A Founder’s Guide ...
Third Rock Techkno
 
Orbitly Pitch DeckA Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Shreyas_Phanse_Resume: Experienced Backend Engineer | Java ‱ Spring Boot ‱ Ka...
SHREYAS PHANSE
 
Software Development Methodologies in 2025
KodekX
 
Enable Enterprise-Ready Security on IBM i Systems.pdf
Precisely
 
Building High-Performance Oracle Teams: Strategic Staffing for Database Manag...
SMACT Works
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Comunidade Salesforce SĂŁo Paulo - Desmistificando o Omnistudio (Vlocity)
Francisco Vieira JĂșnior
 
Top AI API Alternatives to OpenAI: A Side-by-Side Breakdown
vilush
 

#9 Calicut MuleSoft Meetup - Munits in Mule 4.pptx

  • 1. 03rd June 2023 Calicut MuleSoft Meetup Group #9 MUnit in Mule 4
  • 2. Safe Harbour Statement ● Both the speaker and the host are organizing this meet-up in individual capacity only. We are not representing our companies here. ● This presentation is strictly for learning purposes only. Organizer/Presenter do not hold any responsibility that same solution will work for your business requirements. ● This presentation is not meant for any promotional activities. 2
  • 3. A recording of this meetup will be uploaded to events page within 24 hours. Questions can be submitted/asked at any time in the Chat/Questions & Answers Tab. Make it more Interactive!!! Give us feedback! Rate this meetup session by filling feedback form at the end of the day. We Love Feedbacks!!! Its Bread & Butter for Meetup. Housekeeping 3
  • 4. Organizers Fathima Farzana NJC Labs MuleSoft / Integration Developer John Mathew Philip NJC Labs MuleSoft / Integration Developer Anoop Ramachandran NJC Labs Technical Instructor / Integration Architect
  • 6. ✔ MuleSoft Ambassador ✔ MuleSoft Meetup Speaker ✔ Guwahati & Lucknow Meetup Leader ✔ Certified MuleSoft Developer & Architect ✔ Total 8 years of experience (6 in MuleSoft) ✔ Working as Associate Solution Architect at Apisero Inc. Abhishek Bathwal Apisero Inc Associate Solution Architect ● About the Speaker Introduction linkedin.com/in/abhishek-bathwal- 49360694 youtube.com/@abhishekbathwal1805 youtube.com/@developersguide5562 6
  • 7. 7 Agenda Introduction To Munit Different Approach of Writing Munit Limitations of Test Recorder Munit Tools and Components Executing Munit Suits Munit Coverage Live Demonstration
  • 9. 9 MUnit is Anypoint Platform’s dedicated unit testing tool specifically designed for Mule applications. It runs inside a Mule runtime, manually in Anypoint Studio, and automatically as part of the Maven-based CI/CD build process. MUnit is designed to create structural test cases as Mule flows. That means you can use components on top of MUnit and MUnit tool modules. What is Munit?
  • 10. 10 Different Approach of Writing Munit ● Munit Test Recorder ● Manually
  • 11. 11 Limitations with Test Recorder The test recorder is limited in the following ways when you create MUnit tests: ● You cannot create tests for flows with Mule errors raised inside the flow or already existing in the incoming event, not even if they are handled by an on error continue error handler. ● A recorded flow execution ends successfully, but the result does not reach its destination because the application is killed. ● Your validations fail every time your test runs if you configure Spy or Assert processors to assert values for random data, time-dependent information (such as timestamps), or values resulting from parallel processes, because those values change in every execution. ● Mocking values resulting from parallel processes causes a mixture of real and mocked data that compromises the execution of the processors that follow in your test. ● Although the recorder supports data iteration in the flow, such as recursivity or loops, it does not support cases in which the structure of the data being tested changes inside the iteration. ● The recorder does not support mocking a message before or inside a Foreach
  • 12. 12 ● Test ● Mock When ● Set Event ● Asset That ● Assert Equal ● Asset Expression ● Verify Call ● Spy Munit Tools and Components
  • 13. 13 Executing Munit Suite ● From Studio ● From cmd (mvn clean test)
  • 14. 14 Munit Coverage The MUnit Coverage feature provides a measurement of how much of a Mule application has been executed by a set of MUnit tests by counting the amount of event processors executed.This allows you to obtain a quality standard for your application, and provides metrics for: ● Application overall coverage: An average of the items below. ● Resource coverage: Refers to each Mule configuration file under src/main/mule. ● Flow coverage: Refers to any of the following components: Flows, Sub-flows, and Batch jobs.
  • 17. Batch Processing Mule batch processing components are designed for reliable, asynchronous processing of larger-than- memory data sets. The components are the Batch Job, Batch Step, and Batch Aggregator. The Batch Job component automatically splits source data and stores it into persistent queues, which makes it possible to process large data sets while providing reliability. In the event that the application is re- deployed or Mule crashes, the job execution is able to resume at the point it stopped. 17 Phases: ● Load and Dispatch ● Process ● On Complete
  • 19. Demo
  • 20. 20 ● https://docs.mulesoft.com/mule-runtime/3.6/munit ● https://docs.mulesoft.com/munit/2.3/test-recorder ● https://blogs.mulesoft.com/dev-guides/how-to-tutorials/munit-testing-strategies/ ● https://dzone.com/articles/mock-apikitrouter-and-write-munit-test-cases-for-d ● https://youtu.be/iLTqZ_ZcdEs ● https://docs.mulesoft.com/mule-runtime/4.4/batch-processing-concept ● https://javastreets.com/blog/2017/9/mule-batch-processing-part1-introduction.html ● https://billennium.com/blog/munit-for-batch-module-in-mule-4/ Reference
  • 21. Q&A
  • 22. Take a stand ! 22 ●Nominate yourself for the next meetup speaker and suggest a topic as well.
  • 23. 23 ● Share: ○ Tweet using the hashtag #MuleSoftMeetups ○ Invite your network to join: https://meetups.mulesoft.com/calicut/ ● Feedback: ○ Fill out the survey feedback and suggest topics for upcoming events ○ Contact MuleSoft at [email protected] for ways to improve the program What’s next?