Munit parameterization in Mule 4
In this tutorial we will demonstrate how can we use munit parameterization in mule 4 to run the single test case for multiple input and output
To demonstrate we will create a sample mule application and create a munit suite to test the mule application
Sample application:
Here we will create 2 scenarios when the age is greater than and equal to 18 and less than 18, we will create a single test case and configure the 2 different scenarios and run the munit
To create the test case-> right click on the flow and create a blank munit test case for this flow as shown below
Blank test case is created
Create the input and output(expected result) under test folder
To configure the scenarios, go to testcase-> go to global elements->click on edit->
Click on + sign to add the parameterization, provide the name as adult-flow, now select the flow and add the input and output
Now add another scenario as a new parameter and follow the same process
Now set the input as set payload as shown below in munit
Configure the assert as shown below
Now run the munit, you can see both the test cases are passed and both the condition are tested and coverage is 100 %.
Sample application: munit-parameterization
Hi Guys,
Nice tutorial!
Can you please upload the correct sample project as the one uploaded here is “microsoftteam_poc.zip”
can you please upload correct sample project
Hi Guys ,
Can you please help me to run munit test with runtime arguments
Hi Sir,
I’m getting below exception while running the Munit test suit, could you please help me here.
running the test suite build is success but getting pop-up error message like blow.
Exception details:
A problem ocurred while trying to run MUnit:
Path must include project and resource name: /XXXXXXXXEventsService
Thanks,
SS
nice