Nav
You are viewing an older version of this topic. To go to a different version, use the version menu at the upper-right. +

To Operate the MUnit Maven Plugin

This section is dedicated to show how to run your tests using the plugin.

To Run MUnit Tests From Maven

Running MUnit tests in a project example
mvn clean test

To Run a Specific MUnit Test Suite

You can instruct MUnit Maven Plugin to run only tests that belong to a specific test suite.

To do this, we use the property munit.test.

Running a specific MUnit Test Suite example
mvn clean test -Dmunit.test=<regex-test-suite>

The property munit.test accepts regular expressions. The expression is applied to the name of the MUnit Test Suite file. The regular expression language is the Java implementation.
This path is relative to src/test/munit.

The following is a valid example:

mvn clean test -Dmunit.test=.*my-test.*

You can leverage this feature by adding naming conventions to your MUnit Test suites.

To Run Specific MUnit Tests

In the same way that you instruct MUnit to run one test suite, you can also tell it to run a specific test inside that test suite. To do so, we again make use of the property munit.test, with one addition:

mvn clean test -Dmunit.test=<regex-test-suite>#<regex-test-name>

The addition is the special character #. To the right of it you should type the test name. It also accepts regular expressions. The expression is applied to the attribute name of the MUnit Test.

The following is a valid example:

mvn clean test -Dmunit.test=.*my-test.*#.*test-scenario-1.*

The tests inside the MUnit Test Suite that don’t match the regular expression is flagged as ignored.

To Run Tests Using a Specific Tag

You can choose to run only the tests that you grouped under one specific tag.

mvn clean test -Dmunit.tags=<munit-tag>

To Skip All Tests

When building your application, you may want to prevent a test from running. MUnit leverages the same mechanism as Maven, so if you wish to skip tests, you can make use of the parameter skipTests.

Skipping Tests example
mvn clean package -DskipTests

To Skip Only MUnit Tests

MUnit also comes with another property that only prevents MUnit tests from running. While at the same time allowing any other test, like JUnit tests, to keep running.

If you wish to skip only MUnit tests, you can make use of the parameter skipMunitTests.

Skipping MUnit Tests example
mvn clean package -DskipMunitTests
The property skipMunitTests applies only to the XML based MUnit tests.

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.

+