Maven surefire forkMode pertest deprecated. What is the new settings?
Asked Answered
W

2

7

As of Surefire 2.14 the forkMode configuration setting has been deprecated. They even helpfully provide a mapping from some of the old settings to new settings here (http://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html).

The problem is we use <forkMode>pertest</forkMode> which does not have a mapping on that page, and my google-fu is failing to find the appropriate updated configuration for it.

What is the appropriate forkCount, reuseForks, parallel and/or other configuration to replace the deprecated forkMode=pertest setting?

Wheeled answered 17/10, 2016 at 22:0 Comment(1)
Pretty sure this is the same as parallel=classesAndMethods.Feathering
H
12

That isn't mentioned in the documentation, but <forkMode>pertest</forkMode> is the same as always forking. This is the check in the code:

if ( "pertest".equalsIgnoreCase( forkMode ) )
{
    return FORK_ALWAYS;
}

This synonym was made during resolution of the JIRA issue SUREFIRE-96, where, quoting Brett Porter:

pertest and perTest still work, but I've changed it to "always" which seems consistent with "once", and also changed "none" to "never".

As such, you should migrate your current configuration of <forkMode>pertest</forkMode> to forkCount=1 and reuseForks=false, like mentioned in Migrating the Deprecated forkMode Parameter to forkCount and reuseForks.

Heparin answered 17/10, 2016 at 22:23 Comment(1)
The mapping table you linked is unfortunately no longer on the page, but can still be accessed via web.archive.org/web/20161029173525/http://maven.apache.org/…Rebound
A
4

You need to replace

<forkMode>pertest</forkMode> 

with

<forkCount>1</forkCount>
<reuseForks>false</reuseForks>
Anis answered 23/9, 2020 at 19:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.