SlideShare ist ein Scribd-Unternehmen logo
1 von 21
Downloaden Sie, um offline zu lesen
Alexandra Martinez
What is MUnit and how to create
your first unit test
2
● About me
● What is unit testing / MUnit
● Basic MUnit components for unit testing
● Demo
● Questions
Agenda
3
● Senior MuleSoft Developer
● MuleSoft Ambassadress & Meetup Leader
● 5x MuleSoft Certified
● 3+ years using MuleSoft
● Evangelist at Women Who Code Monterrey
● Founder and Content Creator at ProstDev
About me
4
● Type of Software Testing to verify that your code works as expected.
● Create code to test your code 
What is unit testing?
UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST
PASSED?
1 0 PLUS 1 1 1
5
● Type of Software Testing to verify that your code works as expected.
● Create code to test your code 
What is unit testing?
UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST
PASSED?
1 0 PLUS 1 1 1
2 87 PLUS 20 107 107
6
● Type of Software Testing to verify that your code works as expected.
● Create code to test your code 
What is unit testing?
UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST
PASSED?
1 0 PLUS 1 1 1
2 87 PLUS 20 107 107
3 -2 PLUS -2 4 -4
7
● MuleSoft’s framework to create Unit Tests for Mule flows.
● Drag-and-drop / visual components.
● FAIL / PASS visual results.
What is MUnit?
8
● Better quality code
● Final user is happy
● Other developers are happy
● Less time spent fixing bugs after release
● Less budget spent on bug fixes
● Final user is happy
● Other developers are happy
● Project/Delivery/Product Managers are happy
Why do we want to test our code?
(Set Event, Mock, Assert)
Basic MUnit components for unit
testing
10
● Mule Event
● Payload
● Attributes
● Error
● Variables
Mule Event
Error
11
● Set a new Mule Event
● Payload
● Attributes
● Error
● Variables
Set Event
Error
12
Set Event: Example
Error
Set a new Mule Event containing this payload:
Set Event
and containing a variable called isActive set to true.
13
1) Mock when <processor>
2) Then return <Mule Event>
“Imagine that when we try to call that,
we get this Mule Event.”
Mock when
Error
14
1) Mock when <processor>
2) Then return <Mule Event>
“Imagine that when we try to call Salesforce
via HTTP, we get this JSON payload.”
Mock when: Example
Error
1) Mock when processor’s name is “HTTP Request to
Salesforce”
2) Then return a new Mule Event containing this
payload:
Mock when
15
● Assert equals
● Assert that
● Assert expression
”Let’s make sure that this is equal to that.”
“Let’s make sure that this is not empty.”
“Let’s make sure that this is more than that.”
Assert
Error
16
● Assert that
”Let’s make sure that the payload
is equal to this JSON object.”
If they are equal, the test passed.
If not, it failed.
Assert: Example
Error
Assert that the actual payload
is equal to this JSON object:
Assert that
Is this true?
DEMO TIME!
Continue learning
GitHub Repository:
https://github.com/alexandramartinez/vampireAPI
Knowledge check!
1. Take a look at how the MUnit test is built
2. Remove the MUnit test suite
3. Try to build it again!
4. (Optional) Add more tests/validations
Documentation:
● MUnit Event Processors: https://docs.mulesoft.com/munit/2.3/event-processors
● Set Event: https://docs.mulesoft.com/munit/2.3/set-event-processor
● Mock When: https://docs.mulesoft.com/munit/2.3/mock-event-processor
● Assert That: https://docs.mulesoft.com/munit/2.3/assertion-event-processor
Questions?
Contact me!
Website:
www.alexandramartinez.world
LinkedIn:
www.linkedin.com/in/alexandra-n-martinez
Twitter:
@alexmartinez_z
ProstDev
Thank you!

Weitere ähnliche Inhalte

Was ist angesagt?

Automated Performance Testing
Automated Performance TestingAutomated Performance Testing
Automated Performance TestingLars Thorup
 
Insights on Protractor testing
Insights on Protractor testingInsights on Protractor testing
Insights on Protractor testingDejan Toteff
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Vijay Kumbhar
 
Play framework - Bristol Java meetup
Play framework - Bristol Java meetupPlay framework - Bristol Java meetup
Play framework - Bristol Java meetupRobin Warren
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciollaAndrea Paciolla
 
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVAL
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVALWHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVAL
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVALAditi Sharma
 
How to get reviewers to block your changes
How to get reviewers to block your changesHow to get reviewers to block your changes
How to get reviewers to block your changeskevintbenton
 
Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3Jacek Gebal
 
Debugging and Magento
Debugging and MagentoDebugging and Magento
Debugging and MagentoTony Brown
 
Unit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkUnit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkLong Weekend LLC
 
Unit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineUnit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineKeir Bowden
 
Protractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJSProtractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJSKnoldus Inc.
 
Product development with the help of jenkins
Product development with the help of jenkinsProduct development with the help of jenkins
Product development with the help of jenkinsMantas Vaitkūnas
 
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...TestingAR Meetup
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Alin Pandichi
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarGiel Tettelaar
 
Design pattern advanced ii with testing
Design pattern advanced ii with  testingDesign pattern advanced ii with  testing
Design pattern advanced ii with testingJieyi Wu
 
Angular Libraries & NPM
 Angular Libraries & NPM Angular Libraries & NPM
Angular Libraries & NPMKnoldus Inc.
 

Was ist angesagt? (20)

Automated Performance Testing
Automated Performance TestingAutomated Performance Testing
Automated Performance Testing
 
Insights on Protractor testing
Insights on Protractor testingInsights on Protractor testing
Insights on Protractor testing
 
Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy Test Driven Development Methodology and Philosophy
Test Driven Development Methodology and Philosophy
 
Play framework - Bristol Java meetup
Play framework - Bristol Java meetupPlay framework - Bristol Java meetup
Play framework - Bristol Java meetup
 
Javascript tdd byandreapaciolla
Javascript tdd byandreapaciollaJavascript tdd byandreapaciolla
Javascript tdd byandreapaciolla
 
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVAL
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVALWHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVAL
WHY MOODLE PLUGIN DEVELOPMENT NEEDS APPROVAL
 
Protractor: Tips & Tricks
Protractor: Tips & TricksProtractor: Tips & Tricks
Protractor: Tips & Tricks
 
How to get reviewers to block your changes
How to get reviewers to block your changesHow to get reviewers to block your changes
How to get reviewers to block your changes
 
Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3Ukoug webinar - testing PLSQL APIs with utPLSQL v3
Ukoug webinar - testing PLSQL APIs with utPLSQL v3
 
Debugging and Magento
Debugging and MagentoDebugging and Magento
Debugging and Magento
 
Unit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava TalkUnit Testing in iOS - Ninjava Talk
Unit Testing in iOS - Ninjava Talk
 
Unit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with JasmineUnit Testing Lightning Components with Jasmine
Unit Testing Lightning Components with Jasmine
 
Evolve with laravel
Evolve with laravelEvolve with laravel
Evolve with laravel
 
Protractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJSProtractor End To End Testing For AngularJS
Protractor End To End Testing For AngularJS
 
Product development with the help of jenkins
Product development with the help of jenkinsProduct development with the help of jenkins
Product development with the help of jenkins
 
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...
TestingAR XX - Protractor e2e Test Framework - Introduction what we have lear...
 
Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)Unit Testing your React / Redux app (@BucharestJS)
Unit Testing your React / Redux app (@BucharestJS)
 
Dot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel TettelarDot all 2019 | Testing with Craft | Giel Tettelar
Dot all 2019 | Testing with Craft | Giel Tettelar
 
Design pattern advanced ii with testing
Design pattern advanced ii with  testingDesign pattern advanced ii with  testing
Design pattern advanced ii with testing
 
Angular Libraries & NPM
 Angular Libraries & NPM Angular Libraries & NPM
Angular Libraries & NPM
 

Ähnlich wie What is munit and how to create your first unit test

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
 
Toronto mule soft meetup november 2021
Toronto mule soft meetup   november 2021Toronto mule soft meetup   november 2021
Toronto mule soft meetup november 2021Anurag Dwivedi
 
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
 
MuleSoft MUnit Test Recorder Meetup
MuleSoft MUnit Test Recorder MeetupMuleSoft MUnit Test Recorder Meetup
MuleSoft MUnit Test Recorder MeetupAngel Alberici
 
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test RecorderToronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test RecorderAlexandra N. Martinez
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XAmit Singh
 
MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020DianeKesler1
 
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoftMuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoftJitendra Bafna
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017Ortus Solutions, Corp
 
Testing strategies and best practices using MUnit
Testing strategies and best practices using MUnitTesting strategies and best practices using MUnit
Testing strategies and best practices using MUnitJimmy Attia
 
MuleSoft Meetup Charlotte 2019 - Dec 10
MuleSoft Meetup Charlotte  2019 - Dec 10MuleSoft Meetup Charlotte  2019 - Dec 10
MuleSoft Meetup Charlotte 2019 - Dec 10Subhash Patel
 
Software testing enhance quality and performance of software
Software testing enhance quality and performance of softwareSoftware testing enhance quality and performance of software
Software testing enhance quality and performance of softwareEmipro Technologies Pvt. Ltd.
 
Android Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit TestingAndroid Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit Testingmahmoud ramadan
 
Upstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testingUpstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testingDanWooster1
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBaskar K
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkPeter Kofler
 
Automating The New York Times Crossword by Phil Wells
Automating The New York Times Crossword by Phil WellsAutomating The New York Times Crossword by Phil Wells
Automating The New York Times Crossword by Phil WellsSauce Labs
 
Test execution
Test executionTest execution
Test executionadarsh j
 
Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratchWen-Shih Chao
 

Ähnlich wie What is munit and how to create your first unit test (20)

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
 
Toronto mule soft meetup november 2021
Toronto mule soft meetup   november 2021Toronto mule soft meetup   november 2021
Toronto mule soft meetup november 2021
 
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
 
MuleSoft MUnit Test Recorder Meetup
MuleSoft MUnit Test Recorder MeetupMuleSoft MUnit Test Recorder Meetup
MuleSoft MUnit Test Recorder Meetup
 
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test RecorderToronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
Toronto Virtual Meetup #12 - Testing Strategies and MUnit Test Recorder
 
Mule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.XMule Testing in Mulesfoft 4.X
Mule Testing in Mulesfoft 4.X
 
MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020MuleSoft Online MeetUp 03_11_2020
MuleSoft Online MeetUp 03_11_2020
 
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoftMuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
MuleSoft Surat Meetup#46 - Deep Dive into MUnit With MuleSoft
 
UPC Plone Testing Talk
UPC Plone Testing TalkUPC Plone Testing Talk
UPC Plone Testing Talk
 
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
North Virginia Coldfusion User Group Meetup - Testbox - July 19th 2017
 
Testing strategies and best practices using MUnit
Testing strategies and best practices using MUnitTesting strategies and best practices using MUnit
Testing strategies and best practices using MUnit
 
MuleSoft Meetup Charlotte 2019 - Dec 10
MuleSoft Meetup Charlotte  2019 - Dec 10MuleSoft Meetup Charlotte  2019 - Dec 10
MuleSoft Meetup Charlotte 2019 - Dec 10
 
Software testing enhance quality and performance of software
Software testing enhance quality and performance of softwareSoftware testing enhance quality and performance of software
Software testing enhance quality and performance of software
 
Android Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit TestingAndroid Test Driven Development & Android Unit Testing
Android Test Driven Development & Android Unit Testing
 
Upstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testingUpstate CSCI 540 Unit testing
Upstate CSCI 540 Unit testing
 
Beginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NETBeginners - Get Started With Unit Testing in .NET
Beginners - Get Started With Unit Testing in .NET
 
Writing Tests with the Unity Test Framework
Writing Tests with the Unity Test FrameworkWriting Tests with the Unity Test Framework
Writing Tests with the Unity Test Framework
 
Automating The New York Times Crossword by Phil Wells
Automating The New York Times Crossword by Phil WellsAutomating The New York Times Crossword by Phil Wells
Automating The New York Times Crossword by Phil Wells
 
Test execution
Test executionTest execution
Test execution
 
Write unit test from scratch
Write unit test from scratchWrite unit test from scratch
Write unit test from scratch
 

Mehr von Alexandra N. Martinez

Mejora tu productividad creando aplicaciones de Slack
Mejora tu productividad creando aplicaciones de SlackMejora tu productividad creando aplicaciones de Slack
Mejora tu productividad creando aplicaciones de SlackAlexandra N. Martinez
 
Women Who Mule - Workshop series #2: Ghost
Women Who Mule - Workshop series #2: GhostWomen Who Mule - Workshop series #2: Ghost
Women Who Mule - Workshop series #2: GhostAlexandra N. Martinez
 
Women Who Mule - Workshop series: Create your own blog from scratch without a...
Women Who Mule - Workshop series: Create your own blog from scratch without a...Women Who Mule - Workshop series: Create your own blog from scratch without a...
Women Who Mule - Workshop series: Create your own blog from scratch without a...Alexandra N. Martinez
 
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-caseToronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-caseAlexandra N. Martinez
 
Cómo generar e implementar monitoreo para aplicaciones de Mule
Cómo generar e implementar monitoreo para aplicaciones de MuleCómo generar e implementar monitoreo para aplicaciones de Mule
Cómo generar e implementar monitoreo para aplicaciones de MuleAlexandra N. Martinez
 
reCONNECT 2021 May Meetup - Women Who Mule #4
reCONNECT 2021 May Meetup - Women Who Mule #4reCONNECT 2021 May Meetup - Women Who Mule #4
reCONNECT 2021 May Meetup - Women Who Mule #4Alexandra N. Martinez
 
Women Who Mule - April Meetup (Diane Kesler's Journey)
Women Who Mule - April Meetup (Diane Kesler's Journey)Women Who Mule - April Meetup (Diane Kesler's Journey)
Women Who Mule - April Meetup (Diane Kesler's Journey)Alexandra N. Martinez
 
Toronto Virtual Meetup #9 - KPIs and metrics accelerator
Toronto Virtual Meetup #9 - KPIs and metrics acceleratorToronto Virtual Meetup #9 - KPIs and metrics accelerator
Toronto Virtual Meetup #9 - KPIs and metrics acceleratorAlexandra N. Martinez
 
Reviewing a complex dataweave transformation use case v3
Reviewing a complex dataweave transformation use case v3Reviewing a complex dataweave transformation use case v3
Reviewing a complex dataweave transformation use case v3Alexandra N. Martinez
 
Toronto Virtual Meetup #8 - Tips for Reusability
Toronto Virtual Meetup #8 - Tips for ReusabilityToronto Virtual Meetup #8 - Tips for Reusability
Toronto Virtual Meetup #8 - Tips for ReusabilityAlexandra N. Martinez
 
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)Alexandra N. Martinez
 
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...Alexandra N. Martinez
 
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureToronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureAlexandra N. Martinez
 
Reviewing a Complex DataWeave Transformation Use-case v2
Reviewing a Complex DataWeave Transformation Use-case v2Reviewing a Complex DataWeave Transformation Use-case v2
Reviewing a Complex DataWeave Transformation Use-case v2Alexandra N. Martinez
 
How to use Salesforce composite request connector in Mule
How to use Salesforce composite request connector in MuleHow to use Salesforce composite request connector in Mule
How to use Salesforce composite request connector in MuleAlexandra N. Martinez
 
Meetup en español #4 - MuleSoft para profesionales de Java
 Meetup en español #4 - MuleSoft para profesionales de Java Meetup en español #4 - MuleSoft para profesionales de Java
Meetup en español #4 - MuleSoft para profesionales de JavaAlexandra N. Martinez
 
Toronto Virtual Meetup #5 - API Security and Threats
Toronto Virtual Meetup #5 - API Security and ThreatsToronto Virtual Meetup #5 - API Security and Threats
Toronto Virtual Meetup #5 - API Security and ThreatsAlexandra N. Martinez
 

Mehr von Alexandra N. Martinez (20)

Mejora tu productividad creando aplicaciones de Slack
Mejora tu productividad creando aplicaciones de SlackMejora tu productividad creando aplicaciones de Slack
Mejora tu productividad creando aplicaciones de Slack
 
Women Who Mule - Workshop series #2: Ghost
Women Who Mule - Workshop series #2: GhostWomen Who Mule - Workshop series #2: Ghost
Women Who Mule - Workshop series #2: Ghost
 
Women Who Mule - Workshop series: Create your own blog from scratch without a...
Women Who Mule - Workshop series: Create your own blog from scratch without a...Women Who Mule - Workshop series: Create your own blog from scratch without a...
Women Who Mule - Workshop series: Create your own blog from scratch without a...
 
Women Who Mule - June Meetup (EMEA)
Women Who Mule - June Meetup (EMEA)Women Who Mule - June Meetup (EMEA)
Women Who Mule - June Meetup (EMEA)
 
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-caseToronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
Toronto Virtual Meetup #11 - Reviewing Complex DataWeave Transformation Use-case
 
Cómo generar e implementar monitoreo para aplicaciones de Mule
Cómo generar e implementar monitoreo para aplicaciones de MuleCómo generar e implementar monitoreo para aplicaciones de Mule
Cómo generar e implementar monitoreo para aplicaciones de Mule
 
reCONNECT 2021 May Meetup - Women Who Mule #4
reCONNECT 2021 May Meetup - Women Who Mule #4reCONNECT 2021 May Meetup - Women Who Mule #4
reCONNECT 2021 May Meetup - Women Who Mule #4
 
Women Who Mule - April Meetup (Diane Kesler's Journey)
Women Who Mule - April Meetup (Diane Kesler's Journey)Women Who Mule - April Meetup (Diane Kesler's Journey)
Women Who Mule - April Meetup (Diane Kesler's Journey)
 
Toronto Virtual Meetup #9 - KPIs and metrics accelerator
Toronto Virtual Meetup #9 - KPIs and metrics acceleratorToronto Virtual Meetup #9 - KPIs and metrics accelerator
Toronto Virtual Meetup #9 - KPIs and metrics accelerator
 
Reviewing a complex dataweave transformation use case v3
Reviewing a complex dataweave transformation use case v3Reviewing a complex dataweave transformation use case v3
Reviewing a complex dataweave transformation use case v3
 
Introduction to MuleSoft
Introduction to MuleSoftIntroduction to MuleSoft
Introduction to MuleSoft
 
Truly Human part 1
Truly Human part 1Truly Human part 1
Truly Human part 1
 
Toronto Virtual Meetup #8 - Tips for Reusability
Toronto Virtual Meetup #8 - Tips for ReusabilityToronto Virtual Meetup #8 - Tips for Reusability
Toronto Virtual Meetup #8 - Tips for Reusability
 
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
Meetup en español #6 - MuleSoft para profesionales de Java (segunda edición)
 
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...
Meetup en español #5 - Continuous Integration and Continuous Delivery (CI/CD)...
 
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB ArchitectureToronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
Toronto Virtual Meetup #7 - Anypoint VPC, VPN and DLB Architecture
 
Reviewing a Complex DataWeave Transformation Use-case v2
Reviewing a Complex DataWeave Transformation Use-case v2Reviewing a Complex DataWeave Transformation Use-case v2
Reviewing a Complex DataWeave Transformation Use-case v2
 
How to use Salesforce composite request connector in Mule
How to use Salesforce composite request connector in MuleHow to use Salesforce composite request connector in Mule
How to use Salesforce composite request connector in Mule
 
Meetup en español #4 - MuleSoft para profesionales de Java
 Meetup en español #4 - MuleSoft para profesionales de Java Meetup en español #4 - MuleSoft para profesionales de Java
Meetup en español #4 - MuleSoft para profesionales de Java
 
Toronto Virtual Meetup #5 - API Security and Threats
Toronto Virtual Meetup #5 - API Security and ThreatsToronto Virtual Meetup #5 - API Security and Threats
Toronto Virtual Meetup #5 - API Security and Threats
 

Kürzlich hochgeladen

What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?TechSoup
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17Celine George
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...CaraSkikne1
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationMJDuyan
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRATanmoy Mishra
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapitolTechU
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptxmary850239
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17Celine George
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfMohonDas
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice documentXsasf Sfdfasd
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17Celine George
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.raviapr7
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICESayali Powar
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsEugene Lysak
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptxSandy Millin
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational PhilosophyShuvankar Madhu
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and stepobaje godwin sunday
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxraviapr7
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxDr. Asif Anas
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxheathfieldcps1
 

Kürzlich hochgeladen (20)

What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?What is the Future of QuickBooks DeskTop?
What is the Future of QuickBooks DeskTop?
 
How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17How to Add a many2many Relational Field in Odoo 17
How to Add a many2many Relational Field in Odoo 17
 
5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...5 charts on South Africa as a source country for international student recrui...
5 charts on South Africa as a source country for international student recrui...
 
Benefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive EducationBenefits & Challenges of Inclusive Education
Benefits & Challenges of Inclusive Education
 
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRADUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
DUST OF SNOW_BY ROBERT FROST_EDITED BY_ TANMOY MISHRA
 
CapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptxCapTechU Doctoral Presentation -March 2024 slides.pptx
CapTechU Doctoral Presentation -March 2024 slides.pptx
 
3.21.24 The Origins of Black Power.pptx
3.21.24  The Origins of Black Power.pptx3.21.24  The Origins of Black Power.pptx
3.21.24 The Origins of Black Power.pptx
 
How to Solve Singleton Error in the Odoo 17
How to Solve Singleton Error in the  Odoo 17How to Solve Singleton Error in the  Odoo 17
How to Solve Singleton Error in the Odoo 17
 
Diploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdfDiploma in Nursing Admission Test Question Solution 2023.pdf
Diploma in Nursing Admission Test Question Solution 2023.pdf
 
The Singapore Teaching Practice document
The Singapore Teaching Practice documentThe Singapore Teaching Practice document
The Singapore Teaching Practice document
 
How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17How to Add Existing Field in One2Many Tree View in Odoo 17
How to Add Existing Field in One2Many Tree View in Odoo 17
 
Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.Drug Information Services- DIC and Sources.
Drug Information Services- DIC and Sources.
 
Quality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICEQuality Assurance_GOOD LABORATORY PRACTICE
Quality Assurance_GOOD LABORATORY PRACTICE
 
The Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George WellsThe Stolen Bacillus by Herbert George Wells
The Stolen Bacillus by Herbert George Wells
 
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
2024.03.23 What do successful readers do - Sandy Millin for PARK.pptx
 
Philosophy of Education and Educational Philosophy
Philosophy of Education  and Educational PhilosophyPhilosophy of Education  and Educational Philosophy
Philosophy of Education and Educational Philosophy
 
General views of Histopathology and step
General views of Histopathology and stepGeneral views of Histopathology and step
General views of Histopathology and step
 
Prescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptxPrescribed medication order and communication skills.pptx
Prescribed medication order and communication skills.pptx
 
Ultra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptxUltra structure and life cycle of Plasmodium.pptx
Ultra structure and life cycle of Plasmodium.pptx
 
The basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptxThe basics of sentences session 10pptx.pptx
The basics of sentences session 10pptx.pptx
 

What is munit and how to create your first unit test

  • 1. Alexandra Martinez What is MUnit and how to create your first unit test
  • 2. 2 ● About me ● What is unit testing / MUnit ● Basic MUnit components for unit testing ● Demo ● Questions Agenda
  • 3. 3 ● Senior MuleSoft Developer ● MuleSoft Ambassadress & Meetup Leader ● 5x MuleSoft Certified ● 3+ years using MuleSoft ● Evangelist at Women Who Code Monterrey ● Founder and Content Creator at ProstDev About me
  • 4. 4 ● Type of Software Testing to verify that your code works as expected. ● Create code to test your code  What is unit testing? UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST PASSED? 1 0 PLUS 1 1 1
  • 5. 5 ● Type of Software Testing to verify that your code works as expected. ● Create code to test your code  What is unit testing? UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST PASSED? 1 0 PLUS 1 1 1 2 87 PLUS 20 107 107
  • 6. 6 ● Type of Software Testing to verify that your code works as expected. ● Create code to test your code  What is unit testing? UNIT TEST # A PLUS B ACTUAL C EXPECTED C TEST PASSED? 1 0 PLUS 1 1 1 2 87 PLUS 20 107 107 3 -2 PLUS -2 4 -4
  • 7. 7 ● MuleSoft’s framework to create Unit Tests for Mule flows. ● Drag-and-drop / visual components. ● FAIL / PASS visual results. What is MUnit?
  • 8. 8 ● Better quality code ● Final user is happy ● Other developers are happy ● Less time spent fixing bugs after release ● Less budget spent on bug fixes ● Final user is happy ● Other developers are happy ● Project/Delivery/Product Managers are happy Why do we want to test our code?
  • 9. (Set Event, Mock, Assert) Basic MUnit components for unit testing
  • 10. 10 ● Mule Event ● Payload ● Attributes ● Error ● Variables Mule Event Error
  • 11. 11 ● Set a new Mule Event ● Payload ● Attributes ● Error ● Variables Set Event Error
  • 12. 12 Set Event: Example Error Set a new Mule Event containing this payload: Set Event and containing a variable called isActive set to true.
  • 13. 13 1) Mock when <processor> 2) Then return <Mule Event> “Imagine that when we try to call that, we get this Mule Event.” Mock when Error
  • 14. 14 1) Mock when <processor> 2) Then return <Mule Event> “Imagine that when we try to call Salesforce via HTTP, we get this JSON payload.” Mock when: Example Error 1) Mock when processor’s name is “HTTP Request to Salesforce” 2) Then return a new Mule Event containing this payload: Mock when
  • 15. 15 ● Assert equals ● Assert that ● Assert expression ”Let’s make sure that this is equal to that.” “Let’s make sure that this is not empty.” “Let’s make sure that this is more than that.” Assert Error
  • 16. 16 ● Assert that ”Let’s make sure that the payload is equal to this JSON object.” If they are equal, the test passed. If not, it failed. Assert: Example Error Assert that the actual payload is equal to this JSON object: Assert that Is this true?
  • 18. Continue learning GitHub Repository: https://github.com/alexandramartinez/vampireAPI Knowledge check! 1. Take a look at how the MUnit test is built 2. Remove the MUnit test suite 3. Try to build it again! 4. (Optional) Add more tests/validations Documentation: ● MUnit Event Processors: https://docs.mulesoft.com/munit/2.3/event-processors ● Set Event: https://docs.mulesoft.com/munit/2.3/set-event-processor ● Mock When: https://docs.mulesoft.com/munit/2.3/mock-event-processor ● Assert That: https://docs.mulesoft.com/munit/2.3/assertion-event-processor