SlideShare a Scribd company logo
Introduction to Unit Testing
for Mule Flows using
Munit(Java) - Part 1
January 6, 2015
What is a unit test?
A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about
the behavior of that unit of work.
A unit of work is a single logical functional use case in the system that can be invoked by some public interface (in most cases). A unit of
work can span a single method, a whole class or multiple classes working together to achieve one single logical purpose that can be
verified.
What makes a good unit test?
1. Able to be fully automated
2. Has full control over all the pieces running (Use mocks or stubs to achieve this isolation when needed)
3. Can be run in any order if part of many other tests
4. Runs in memory (no DB or File access, for example)
5. Consistently returns the same result (You always run the same test, so no random numbers, for example.
save those for integration or range tests)
6. Runs fast
7. Tests a single logical concept in the system
8. Readable
9. Maintainable
10.Trustworthy (when you see its result, you don’t need to debug the code just to be sure)
Why do we need a Unit Test?
1. Tests Reduce Bugs in New Features
2. Tests Reduce Bugs in Existing Features
3. Tests Are Good Documentation
4. Tests Reduce the Cost of Change
5. Tests Improve Design
6. Tests Allow Refactoring
7. Tests Constrain Features
8. Tests Defend Against Other Programmers
Dependencies
Anypoint Studio (any Runtime)
● Junit
● Munit
● Hamcrest
What is JUnit?
JUnit is a simple framework to write repeatable tests. It is an instance of the
xUnit architecture for unit testing frameworks.
What is Munit?
MUnit is a Mule application testing framework that allows you to easily build automated tests for your
integrations and APIs. It provides a full suite of integration and unit test capabilities, and is fully
integrated with Maven and Surefire for integration with your continuous deployment environment.
Munit Capabilities
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
Munit Capabilities
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
Credits
http://artofunittesting.com/definition-of-a-unit-test/
http://junit.org/
https://docs.mulesoft.com/mule-user-guide/v/3.7/munit
http://www.onjava.com/pub/a/onjava/2003/04/02/javaxpckbk.html

More Related Content

What's hot

Mule integration-application
Mule integration-applicationMule integration-application
Mule integration-application
Naresh Naidu
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
Sudha Ch
 
Content based routing tutorial in mule
Content based routing tutorial in muleContent based routing tutorial in mule
Content based routing tutorial in mule
Sindhu VL
 
Waits alerts and switch windows
Waits alerts and switch windowsWaits alerts and switch windows
Waits alerts and switch windows
Ducat
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applications
kumar gaurav
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
F K
 
Idempotent filter in mule
Idempotent filter in muleIdempotent filter in mule
Idempotent filter in mule
Mohammed246
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
Sindhu VL
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
F K
 
Best way to deploy mule application
Best way to deploy mule applicationBest way to deploy mule application
Best way to deploy mule application
Sanjeet Pandey
 
Deploy mule application
Deploy mule applicationDeploy mule application
Deploy mule application
Son Nguyen
 
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
BugRaptors
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
Mohammed246
 
Quartz connector mule
Quartz connector   muleQuartz connector   mule
Quartz connector mule
Sindhu VL
 
Mule
MuleMule
Mule
irfan1008
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in mule
Anirban Sen Chowdhary
 
Selenium Automation Framework (SAF).
Selenium Automation Framework (SAF).Selenium Automation Framework (SAF).
Selenium Automation Framework (SAF).
Mindtree Ltd.
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
Khan625
 
Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview Questions
Pankaj Chauhan
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
Praneethchampion
 

What's hot (20)

Mule integration-application
Mule integration-applicationMule integration-application
Mule integration-application
 
Mule management console installation with Tomcat
Mule management console installation with TomcatMule management console installation with Tomcat
Mule management console installation with Tomcat
 
Content based routing tutorial in mule
Content based routing tutorial in muleContent based routing tutorial in mule
Content based routing tutorial in mule
 
Waits alerts and switch windows
Waits alerts and switch windowsWaits alerts and switch windows
Waits alerts and switch windows
 
Mulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other ApplicationsMulesoft Calling Flow of Other Applications
Mulesoft Calling Flow of Other Applications
 
Idempotent filter in Mule
Idempotent filter in MuleIdempotent filter in Mule
Idempotent filter in Mule
 
Idempotent filter in mule
Idempotent filter in muleIdempotent filter in mule
Idempotent filter in mule
 
Component bindings in mule
Component bindings in muleComponent bindings in mule
Component bindings in mule
 
Automatic documentation with mule
Automatic documentation with muleAutomatic documentation with mule
Automatic documentation with mule
 
Best way to deploy mule application
Best way to deploy mule applicationBest way to deploy mule application
Best way to deploy mule application
 
Deploy mule application
Deploy mule applicationDeploy mule application
Deploy mule application
 
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
 
Quartz in Mule
Quartz in MuleQuartz in Mule
Quartz in Mule
 
Quartz connector mule
Quartz connector   muleQuartz connector   mule
Quartz connector mule
 
Mule
MuleMule
Mule
 
Using spring task scheduler in java in mule
Using spring task scheduler in java in muleUsing spring task scheduler in java in mule
Using spring task scheduler in java in mule
 
Selenium Automation Framework (SAF).
Selenium Automation Framework (SAF).Selenium Automation Framework (SAF).
Selenium Automation Framework (SAF).
 
Mule with drools
Mule with droolsMule with drools
Mule with drools
 
Cakephp Interview Questions
Cakephp Interview QuestionsCakephp Interview Questions
Cakephp Interview Questions
 
Mule quartz
Mule quartz Mule quartz
Mule quartz
 

Similar to Introduction to Unit Testing for Mule Flows using Munit(Java) - Part 1

Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
Anand kalla
 
Munit_in_mule_naveen
Munit_in_mule_naveenMunit_in_mule_naveen
Munit_in_mule_naveen
VenkataNaveen Kumar
 
Implementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsImplementing TDD in for .net Core applications
Implementing TDD in for .net Core applications
Ahmad Kazemi
 
5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests
Serena Gray
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
Hong Le Van
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
Facundo Farias
 
Testing mule
Testing   muleTesting   mule
Testing mule
Sindhu VL
 
Mule testing
Mule   testingMule   testing
Mule testing
Sindhu VL
 
Unit Testing vs Integration Testing
Unit Testing vs Integration TestingUnit Testing vs Integration Testing
Unit Testing vs Integration Testing
Rock Interview
 
Qtp (2)
Qtp (2)Qtp (2)
Qtp (2)
soujanya k
 
Mule testing
Mule testingMule testing
Mule testing
Shanky Gupta
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
Quontra Solutions
 
Introduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnitIntroduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnit
Mindfire Solutions
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
Adam Stephensen
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.
Mohamed Taman
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
Ahmed M. Gomaa
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
Pavlo Hodysh
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
Onkar Deshpande
 

Similar to Introduction to Unit Testing for Mule Flows using Munit(Java) - Part 1 (20)

Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
 
Munit_in_mule_naveen
Munit_in_mule_naveenMunit_in_mule_naveen
Munit_in_mule_naveen
 
Implementing TDD in for .net Core applications
Implementing TDD in for .net Core applicationsImplementing TDD in for .net Core applications
Implementing TDD in for .net Core applications
 
5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests5 Best Unit Test Frameworks to Automate Unit Tests
5 Best Unit Test Frameworks to Automate Unit Tests
 
Unit testing, principles
Unit testing, principlesUnit testing, principles
Unit testing, principles
 
Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++Test driven development and unit testing with examples in C++
Test driven development and unit testing with examples in C++
 
TDD Workshop UTN 2012
TDD Workshop UTN 2012TDD Workshop UTN 2012
TDD Workshop UTN 2012
 
Testing mule
Testing   muleTesting   mule
Testing mule
 
Mule testing
Mule   testingMule   testing
Mule testing
 
Unit Testing vs Integration Testing
Unit Testing vs Integration TestingUnit Testing vs Integration Testing
Unit Testing vs Integration Testing
 
Qtp (2)
Qtp (2)Qtp (2)
Qtp (2)
 
Mule testing
Mule testingMule testing
Mule testing
 
Automated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra SolutionsAutomated Software Testing Framework Training by Quontra Solutions
Automated Software Testing Framework Training by Quontra Solutions
 
Introduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnitIntroduction To UnitTesting & JUnit
Introduction To UnitTesting & JUnit
 
Quality for developers
Quality for developersQuality for developers
Quality for developers
 
An introduction to unit testing
An introduction to unit testingAn introduction to unit testing
An introduction to unit testing
 
Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.Unit testing & TDD concepts with best practice guidelines.
Unit testing & TDD concepts with best practice guidelines.
 
Unit Testing in Java
Unit Testing in JavaUnit Testing in Java
Unit Testing in Java
 
Unit & integration testing
Unit & integration testingUnit & integration testing
Unit & integration testing
 
JUnit- A Unit Testing Framework
JUnit- A Unit Testing FrameworkJUnit- A Unit Testing Framework
JUnit- A Unit Testing Framework
 

More from Alex Fernandez

Shipping your logs to elk from mule app/cloudhub part 3
Shipping  your logs to elk from mule app/cloudhub  part 3Shipping  your logs to elk from mule app/cloudhub  part 3
Shipping your logs to elk from mule app/cloudhub part 3
Alex Fernandez
 
Shipping your logs to elk from mule app/cloudhub part 2
Shipping your logs to elk from mule app/cloudhub   part 2Shipping your logs to elk from mule app/cloudhub   part 2
Shipping your logs to elk from mule app/cloudhub part 2
Alex Fernandez
 
Shipping your logs to elk from mule app/cloudhub part 1
Shipping  your logs to elk from mule app/cloudhub   part 1Shipping  your logs to elk from mule app/cloudhub   part 1
Shipping your logs to elk from mule app/cloudhub part 1
Alex Fernandez
 
My journey and learnings using mule esb 2
My journey and learnings using mule esb 2My journey and learnings using mule esb 2
My journey and learnings using mule esb 2
Alex Fernandez
 
My journey and learnings using mule esb part 1
My journey and learnings using mule esb part 1My journey and learnings using mule esb part 1
My journey and learnings using mule esb part 1
Alex Fernandez
 
docker compose
docker composedocker compose
docker compose
Alex Fernandez
 
Spring batch introduction
Spring batch introductionSpring batch introduction
Spring batch introduction
Alex Fernandez
 
Creating debian package in mule apps 1
Creating debian package in mule apps 1Creating debian package in mule apps 1
Creating debian package in mule apps 1
Alex Fernandez
 
Data communication part 6
Data communication  part 6Data communication  part 6
Data communication part 6
Alex Fernandez
 
Data communication Part 11
Data communication Part 11Data communication Part 11
Data communication Part 11
Alex Fernandez
 
Data communication part 8
Data communication part 8Data communication part 8
Data communication part 8
Alex Fernandez
 
Data communication part 7
Data communication part 7Data communication part 7
Data communication part 7
Alex Fernandez
 
Using schemas in parsing xml part 1
Using schemas in parsing xml part 1Using schemas in parsing xml part 1
Using schemas in parsing xml part 1
Alex Fernandez
 
Using schemas in parsing xml part 2
Using schemas in parsing xml part 2Using schemas in parsing xml part 2
Using schemas in parsing xml part 2
Alex Fernandez
 
Data Communication Concepts Part 5
Data Communication Concepts Part 5Data Communication Concepts Part 5
Data Communication Concepts Part 5
Alex Fernandez
 
Jasper Report - Lesson
Jasper Report - LessonJasper Report - Lesson
Jasper Report - Lesson
Alex Fernandez
 

More from Alex Fernandez (16)

Shipping your logs to elk from mule app/cloudhub part 3
Shipping  your logs to elk from mule app/cloudhub  part 3Shipping  your logs to elk from mule app/cloudhub  part 3
Shipping your logs to elk from mule app/cloudhub part 3
 
Shipping your logs to elk from mule app/cloudhub part 2
Shipping your logs to elk from mule app/cloudhub   part 2Shipping your logs to elk from mule app/cloudhub   part 2
Shipping your logs to elk from mule app/cloudhub part 2
 
Shipping your logs to elk from mule app/cloudhub part 1
Shipping  your logs to elk from mule app/cloudhub   part 1Shipping  your logs to elk from mule app/cloudhub   part 1
Shipping your logs to elk from mule app/cloudhub part 1
 
My journey and learnings using mule esb 2
My journey and learnings using mule esb 2My journey and learnings using mule esb 2
My journey and learnings using mule esb 2
 
My journey and learnings using mule esb part 1
My journey and learnings using mule esb part 1My journey and learnings using mule esb part 1
My journey and learnings using mule esb part 1
 
docker compose
docker composedocker compose
docker compose
 
Spring batch introduction
Spring batch introductionSpring batch introduction
Spring batch introduction
 
Creating debian package in mule apps 1
Creating debian package in mule apps 1Creating debian package in mule apps 1
Creating debian package in mule apps 1
 
Data communication part 6
Data communication  part 6Data communication  part 6
Data communication part 6
 
Data communication Part 11
Data communication Part 11Data communication Part 11
Data communication Part 11
 
Data communication part 8
Data communication part 8Data communication part 8
Data communication part 8
 
Data communication part 7
Data communication part 7Data communication part 7
Data communication part 7
 
Using schemas in parsing xml part 1
Using schemas in parsing xml part 1Using schemas in parsing xml part 1
Using schemas in parsing xml part 1
 
Using schemas in parsing xml part 2
Using schemas in parsing xml part 2Using schemas in parsing xml part 2
Using schemas in parsing xml part 2
 
Data Communication Concepts Part 5
Data Communication Concepts Part 5Data Communication Concepts Part 5
Data Communication Concepts Part 5
 
Jasper Report - Lesson
Jasper Report - LessonJasper Report - Lesson
Jasper Report - Lesson
 

Recently uploaded

Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
AMB-Review
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
informapgpstrackings
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 

Recently uploaded (20)

Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdfDominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
Dominate Social Media with TubeTrivia AI’s Addictive Quiz Videos.pdf
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
Field Employee Tracking System| MiTrack App| Best Employee Tracking Solution|...
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 

Introduction to Unit Testing for Mule Flows using Munit(Java) - Part 1

  • 1. Introduction to Unit Testing for Mule Flows using Munit(Java) - Part 1 January 6, 2015
  • 2. What is a unit test? A unit test is an automated piece of code that invokes a unit of work in the system and then checks a single assumption about the behavior of that unit of work. A unit of work is a single logical functional use case in the system that can be invoked by some public interface (in most cases). A unit of work can span a single method, a whole class or multiple classes working together to achieve one single logical purpose that can be verified.
  • 3. What makes a good unit test? 1. Able to be fully automated 2. Has full control over all the pieces running (Use mocks or stubs to achieve this isolation when needed) 3. Can be run in any order if part of many other tests 4. Runs in memory (no DB or File access, for example) 5. Consistently returns the same result (You always run the same test, so no random numbers, for example. save those for integration or range tests) 6. Runs fast 7. Tests a single logical concept in the system 8. Readable 9. Maintainable 10.Trustworthy (when you see its result, you don’t need to debug the code just to be sure)
  • 4. Why do we need a Unit Test? 1. Tests Reduce Bugs in New Features 2. Tests Reduce Bugs in Existing Features 3. Tests Are Good Documentation 4. Tests Reduce the Cost of Change 5. Tests Improve Design 6. Tests Allow Refactoring 7. Tests Constrain Features 8. Tests Defend Against Other Programmers
  • 5. Dependencies Anypoint Studio (any Runtime) ● Junit ● Munit ● Hamcrest
  • 6. What is JUnit? JUnit is a simple framework to write repeatable tests. It is an instance of the xUnit architecture for unit testing frameworks.
  • 7. What is Munit? MUnit is a Mule application testing framework that allows you to easily build automated tests for your integrations and APIs. It provides a full suite of integration and unit test capabilities, and is fully integrated with Maven and Surefire for integration with your continuous deployment environment.
  • 8. Munit Capabilities 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
  • 9. Munit Capabilities 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