Fork me on GitHub

Using Console Logs

Suppressed logs

Since version 2.19 few lines are suppressed by surefire and failsafe plugin in std/out, namely

  • report directory,
  • Java class of provider,
  • configuration of parallel execution and
  • Java class of TestNG configurator.

In order to enable detailed logs, use any of CLI Maven option, i.e. -X,--debug,-e,--errors. The result would be e.g.:

[INFO] Surefire report directory: /path/to/project/target/surefire-reports
[INFO] Using configured provider org.apache.maven.surefire.junitcore.JUnitCoreProvider
[INFO] parallel='none', perCoreThreadCount=true, threadCount=0, useUnlimitedThreads=false, threadCountSuites=0, threadCountClasses=0, threadCountMethods=0, parallelOptimized=true
Configuring TestNG with: TestNGMapConfigurator

Stack Trace Filtering (Since 3.6.0)

When capturing console output from tests, Surefire stores stack traces to associate output with the correct test class. To reduce memory consumption, stack traces are truncated to 15 frames and JDK classes (java., javax., sun., jdk.) are filtered by default. This provides approximately 50% memory savings for console output capture.

You can customize the filtering with the stackTraceFilterPrefixes parameter:

<plugins>
    [...]
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <stackTraceFilterPrefixes>
            <prefix>org.springframework.</prefix>
            <prefix>org.junit.</prefix>
          </stackTraceFilterPrefixes>
        </configuration>
      </plugin>
    [...]
</plugins>

When specified, this replaces the default filters (does not add to them).

To disable all filtering, use an empty value via command line:

mvn test -Dsurefire.stackTraceFilterPrefixes=""

On Java 9 and later, stack capture uses StackWalker by default. If that causes a problem in a test JVM, set the JVM system property surefire.stackTrace.disableStackWalker=true to use Thread.getStackTrace() while retaining stack capture. For forked tests, pass the property through argLine:

<configuration>
  <argLine>-Dsurefire.stackTrace.disableStackWalker=true</argLine>
</configuration>

If argLine already contains JVM options, append this property rather than replacing them.