When running several tests, the build output can get very complex to read. MUnit allows you to redirect the output of each test suite to a file. This way, the test results remain in the build output and you can check the respective file to check the standard output of each test suite.
You can find these files in the testOutputDirectory folder following the naming convention: munit.${suiteName}-output.txt, where suiteName represents the name of the XML file relative to the MUnit test folder.
The test output that doesn’t belong to a particular suite isn’t printed to keep the build output clean. You can enable it by running Maven in debug mode.
To redirect the output of each test suite to a file:
Redirect test output to a file
<plugins>
<plugin>
<groupId>com.mulesoft.munit.tools</groupId>
<artifactId>munit-maven-plugin</artifactId>
<configuration>
...
<redirectTestOutputToFile>true</redirectTestOutputToFile>
...
</configuration>
</plugin>
</plugins>
By default, it’s set to false.
Test Output Directory
If you want to choose the location where the test creates the output files, the path specified can be absolute or written as a Maven placeholder:
Test output directory with absolute path
<plugins>
<plugin>
<groupId>com.mulesoft.munit.tools</groupId>
<artifactId>munit-maven-plugin</artifactId>
<configuration>
...
<testOutputDirectory>/my/absolute/path</testOutputDirectory>
...
</configuration>
</plugin>
</plugins>
Test output directory using Maven placeholders
<testOutputDirectory>${project.build.directory}/my/output/folder</testOutputDirectory>
By default, the files are created in ${project.build.directory}/munit-reports/output/.