In this Article we will see how to run single munit at a time through command line and from Anypoint studio.
Also we will see how to run MUnits using Tags from command line
Run the following command at the project root folder.
In the following example, the MUnit test file is called run-single-munit-test-suite.xml
mvn clean test -Dmunit.test=run-single-munit-test-suite.xml
mvn clean test -Dmunit.test=abc.xml#testName
mvn clean test -Dmunit.test=mvn clean test -Dmunit.test=run-single-munit-test-suite.xml#run-single-munit-test-suite-run-single-munitFlowTest
In this case, the "testName" is the name of the test to be executed.
mvn clean test -Dmunit.tags=flow
Above command will run all the munit tests tagged as name "flow"
You can also use combination as below:
mvn clean test -Dmunit.test=run-single-munit-test-suite.xml -Dmunit.tags=flow
Please find sample Mule project in Github run-single-munit-Mule4
Happy learning :)
Also we will see how to run MUnits using Tags from command line
Execute from Command Line
Using "mvn test" at the terminal will test all MUnit tests, but here we describe how to test only one MUnit fileRun the following command at the project root folder.
In the following example, the MUnit test file is called run-single-munit-test-suite.xml
mvn clean test -Dmunit.test=run-single-munit-test-suite.xml
Running Single MUnit test case
XML file contains several tests, you may add the test name like this:
In this case, the "testName" is the name of the test to be executed.
Execute from AnypointStudio
Right click in Munit file --> Run MUnit suite
Right click on test Name--> Run MUnit test
Running Munit using Tags CommandLine
Tags are important to categorize the MUnits that needs to be executed based on the requirement. It is more like developer friendly to execute the different test scenarios.
Above command will run all the munit tests tagged as name "flow"
You can also use combination as below:
mvn clean test -Dmunit.test=run-single-munit-test-suite.xml -Dmunit.tags=flow
Please find sample Mule project in Github run-single-munit-Mule4
Happy learning :)