November 2021
Toronto MuleSoft Meetup
MUnit, Test Recorder & Parameterizations
2
●About organizer:
○ MuleSoft Meetup Barcelona’s Leader
○ Senior Developer @Cognizant
○ MuleSoft Certified Developer
●About Cognizant:
○ Cognizant is a global system integrator
○ Founded in 1994. Around 290.000 employees
○ 250+ Mule Projects
Introduction Flavio Natale
3
The brutal truth
Expectation
4
The brutal truth
Reality
5
● MUnit Introduction
● Quiz
● MUnit Test Recorder + Parameterizations
● Quiz
● Toss-up
Agenda
MUnit
7
● Types Of Testing: Unit Testing, Integration Testing, Performance Testing
● MUnit
● Sub-Modules & Scopes
Agenda
Types of Testing
8
8
Unit Testing Integration Testing Perfomance Testing
Used to verify the
functionality of a specific
unit (i.e: flow or sublflow).
Used to verify that all of
the interactions are
functional with the systems
that the application
interacts with.
In this type of Testing both
input and output data are
validated when interacting
with external systems.
The main purpose of this
type of Testing is to verify
performance and behavior
of the systems and
environments as well as
scalability and usage of
resources under high load
work.
MUnit
9
9
MUnit is a Mule application testing framework.
Embedded
in Anypoint
Studio
CI/CD
Self-
Generated
Tests
Local
Testing
Coverage
Report
Scopes
10
10
MUnit test is divided in three scopes:
1- Behavior
Used to configure pre-conditions before the execution, mocks and spies.
2- Execution
Used to define the logic of the test, typically a Flow Reference.
3- Validation
Used to validate the results of the execution. Here you can add assertions and verifiers.
Sub-Modules
11
11
MUnit MUnit Tools
MUnit has 2 Sub-Modules:
Quiz
13
1.- How many Sub-Modules are in MUnit? 1, 2 or 3?
Quiz
14
2.- Which of the next sentences is false?
A) MUnit generates a coverage report about executed test
B) MUnit allows us to test locally
C) MUnit is a framework that is not embedded in Anypoint Studio
Quiz
Munit – Test Recorder &
Parameterizations
16
● Test Recorder: What is it?, How does it work?
● Parameterizations
● Demo
● Quiz
Agenda
Test Recorder: What is it?
17
17
Anypoint Studio>= 7.5.0
Munit Test Recorder
Is a tool embedded in Anypoint Studio that allows us to record an entire
flow and with that recording configure a test based on such event.
❖ Captures real information as it passes through the
application.
❖ It allows us to create automatically a test in which you
can configure the mocks and assertions needed.
Test Recorder: How does it work?
18
18
1 3
2 4
5
Record Test
Test Recorder: How does it work?
19
19
Test Recorder: How does it work?
20
20
1 3
2 4
5
Execute Flow
Record Test
Test Recorder: How does it work?
21
21
Test Recorder: How does it work?
22
22
1 3
2 4
5
Execute Flow
Configure new MUnit
Test
Record Test
Test Recorder: How does it work?
23
23
Test Recorder: How does it work?
24
24
1 3
2 4
5
Execute Flow Run new MUnit Test
Configure new MUnit Test
Record Test
Test Recorder: How does it work?
25
25
Test Recorder: How does it work?
26
26
1 3
2 4
5
Execute Flow Run new MUnit Test
Evaluate results
Configure new MUnit Test
Record Test
Test Recorder: How does it work?
27
27
28
28
Allows to execute a request with multiple/different inputs. 3 methods can be used.
Method 1 - YAML
Method 2 – Paramaeter within config XML
1.- Create YAML under src/test/resources
2.- Reference to YAML from XML
3.- Reference to variable in behavior
Parameterizations
Parameterizations
29
29
Method 3 – YAML + Parameter within config XML
Demo
Quiz
33
1.- Test Recorder is an accelerator you can download and it can be used since
Mule 3. True or False?
Quiz
34
2.- In order to use Parameterizations is not mandatory to create a yaml. True or false?
Quiz
Thank you!
Toss-up
Till next time!

Toronto mule soft meetup november 2021

  • 1.
    November 2021 Toronto MuleSoftMeetup MUnit, Test Recorder & Parameterizations
  • 2.
    2 ●About organizer: ○ MuleSoftMeetup Barcelona’s Leader ○ Senior Developer @Cognizant ○ MuleSoft Certified Developer ●About Cognizant: ○ Cognizant is a global system integrator ○ Founded in 1994. Around 290.000 employees ○ 250+ Mule Projects Introduction Flavio Natale
  • 3.
  • 4.
  • 5.
    5 ● MUnit Introduction ●Quiz ● MUnit Test Recorder + Parameterizations ● Quiz ● Toss-up Agenda
  • 6.
  • 7.
    7 ● Types OfTesting: Unit Testing, Integration Testing, Performance Testing ● MUnit ● Sub-Modules & Scopes Agenda
  • 8.
    Types of Testing 8 8 UnitTesting Integration Testing Perfomance Testing Used to verify the functionality of a specific unit (i.e: flow or sublflow). Used to verify that all of the interactions are functional with the systems that the application interacts with. In this type of Testing both input and output data are validated when interacting with external systems. The main purpose of this type of Testing is to verify performance and behavior of the systems and environments as well as scalability and usage of resources under high load work.
  • 9.
    MUnit 9 9 MUnit is aMule application testing framework. Embedded in Anypoint Studio CI/CD Self- Generated Tests Local Testing Coverage Report
  • 10.
    Scopes 10 10 MUnit test isdivided in three scopes: 1- Behavior Used to configure pre-conditions before the execution, mocks and spies. 2- Execution Used to define the logic of the test, typically a Flow Reference. 3- Validation Used to validate the results of the execution. Here you can add assertions and verifiers.
  • 11.
  • 12.
  • 13.
    13 1.- How manySub-Modules are in MUnit? 1, 2 or 3? Quiz
  • 14.
    14 2.- Which ofthe next sentences is false? A) MUnit generates a coverage report about executed test B) MUnit allows us to test locally C) MUnit is a framework that is not embedded in Anypoint Studio Quiz
  • 15.
    Munit – TestRecorder & Parameterizations
  • 16.
    16 ● Test Recorder:What is it?, How does it work? ● Parameterizations ● Demo ● Quiz Agenda
  • 17.
    Test Recorder: Whatis it? 17 17 Anypoint Studio>= 7.5.0 Munit Test Recorder Is a tool embedded in Anypoint Studio that allows us to record an entire flow and with that recording configure a test based on such event. ❖ Captures real information as it passes through the application. ❖ It allows us to create automatically a test in which you can configure the mocks and assertions needed.
  • 18.
    Test Recorder: Howdoes it work? 18 18 1 3 2 4 5 Record Test
  • 19.
    Test Recorder: Howdoes it work? 19 19
  • 20.
    Test Recorder: Howdoes it work? 20 20 1 3 2 4 5 Execute Flow Record Test
  • 21.
    Test Recorder: Howdoes it work? 21 21
  • 22.
    Test Recorder: Howdoes it work? 22 22 1 3 2 4 5 Execute Flow Configure new MUnit Test Record Test
  • 23.
    Test Recorder: Howdoes it work? 23 23
  • 24.
    Test Recorder: Howdoes it work? 24 24 1 3 2 4 5 Execute Flow Run new MUnit Test Configure new MUnit Test Record Test
  • 25.
    Test Recorder: Howdoes it work? 25 25
  • 26.
    Test Recorder: Howdoes it work? 26 26 1 3 2 4 5 Execute Flow Run new MUnit Test Evaluate results Configure new MUnit Test Record Test
  • 27.
    Test Recorder: Howdoes it work? 27 27
  • 28.
    28 28 Allows to executea request with multiple/different inputs. 3 methods can be used. Method 1 - YAML Method 2 – Paramaeter within config XML 1.- Create YAML under src/test/resources 2.- Reference to YAML from XML 3.- Reference to variable in behavior Parameterizations
  • 29.
    Parameterizations 29 29 Method 3 –YAML + Parameter within config XML
  • 30.
  • 32.
  • 33.
    33 1.- Test Recorderis an accelerator you can download and it can be used since Mule 3. True or False? Quiz
  • 34.
    34 2.- In orderto use Parameterizations is not mandatory to create a yaml. True or false? Quiz
  • 35.
  • 36.
  • 37.