Maven Surefire Forked Test Execution in a multimodule project

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Maven Surefire Forked Test Execution in a multimodule project

Debraj Manna
Hi

I am reading the maven surefire documentation
<https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html>
about
the forked test execution. It states

*The default setting is forkCount=1/reuseForks=true, which means that
maven-surefire-plugin creates one new JVM process to execute all tests in
one Maven module.*

*forkCount=1/reuseForks=false executes each test class in its own JVM
process, one after another. It creates the highest level of separation for
the test execution, but it would probably also give you the longest
execution time of all the available options. Consider it as a last reso*rt.


Can someone resolve my below doubts about the above para:

In a maven multimodule project if I am setting forkcount=3 /
reuseForks=true. Then does that mean maven-surefire-plugin will create 3
new JVM processes and then execute tests from 3 modules in 3 JVM and all
tests from a module will be running in the same JVM?
Reply | Threaded
Open this post in threaded view
|

Re: Maven Surefire Forked Test Execution in a multimodule project

Enrico Olivelli
Manna

Il Gio 9 Apr 2020, 13:09 Debraj Manna <[hidden email]> ha scritto:

> Hi
>
> I am reading the maven surefire documentation
> <
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
> >
> about
> the forked test execution. It states
>
> *The default setting is forkCount=1/reuseForks=true, which means that
> maven-surefire-plugin creates one new JVM process to execute all tests in
> one Maven module.*
>
> *forkCount=1/reuseForks=false executes each test class in its own JVM
> process, one after another. It creates the highest level of separation for
> the test execution, but it would probably also give you the longest
> execution time of all the available options. Consider it as a last reso*rt.
>
>
> Can someone resolve my below doubts about the above para:
>
> In a maven multimodule project if I am setting forkcount=3 /
> reuseForks=true. Then does that mean maven-surefire-plugin will create 3
> new JVM processes and then execute tests from 3 modules in 3 JVM and all
> tests from a module will be running in the same JVM?
>

No.
If you want to run parallel execution of modules you have to use -T option
This is independent from surefire

Enrico
Reply | Threaded
Open this post in threaded view
|

Re: Maven Surefire Forked Test Execution in a multimodule project

Debraj Manna
Thanks Enrico.

On Thu, Apr 9, 2020 at 4:46 PM Enrico Olivelli <[hidden email]> wrote:

> Manna
>
> Il Gio 9 Apr 2020, 13:09 Debraj Manna <[hidden email]> ha
> scritto:
>
> > Hi
> >
> > I am reading the maven surefire documentation
> > <
> >
> https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html
> > >
> > about
> > the forked test execution. It states
> >
> > *The default setting is forkCount=1/reuseForks=true, which means that
> > maven-surefire-plugin creates one new JVM process to execute all tests in
> > one Maven module.*
> >
> > *forkCount=1/reuseForks=false executes each test class in its own JVM
> > process, one after another. It creates the highest level of separation
> for
> > the test execution, but it would probably also give you the longest
> > execution time of all the available options. Consider it as a last
> reso*rt.
> >
> >
> > Can someone resolve my below doubts about the above para:
> >
> > In a maven multimodule project if I am setting forkcount=3 /
> > reuseForks=true. Then does that mean maven-surefire-plugin will create 3
> > new JVM processes and then execute tests from 3 modules in 3 JVM and all
> > tests from a module will be running in the same JVM?
> >
>
> No.
> If you want to run parallel execution of modules you have to use -T option
> This is independent from surefire
>
> Enrico
>
Reply | Threaded
Open this post in threaded view
|

Re: Maven Surefire Forked Test Execution in a multimodule project

Tibor Digana
In reply to this post by Debraj Manna
Enrico is right.

Surefire does NOT execute 3 Maven modules in parallel.
Opposite!
One module executes Surefire which divides the test into 3 additional
JVMs and the Surefire (module) is waiting for their completion.

On Thu, Apr 9, 2020 at 1:09 PM Debraj Manna <[hidden email]> wrote:

>
> Hi
>
> I am reading the maven surefire documentation
> <https://maven.apache.org/surefire/maven-surefire-plugin/examples/fork-options-and-parallel-execution.html>
> about
> the forked test execution. It states
>
> *The default setting is forkCount=1/reuseForks=true, which means that
> maven-surefire-plugin creates one new JVM process to execute all tests in
> one Maven module.*
>
> *forkCount=1/reuseForks=false executes each test class in its own JVM
> process, one after another. It creates the highest level of separation for
> the test execution, but it would probably also give you the longest
> execution time of all the available options. Consider it as a last reso*rt.
>
>
> Can someone resolve my below doubts about the above para:
>
> In a maven multimodule project if I am setting forkcount=3 /
> reuseForks=true. Then does that mean maven-surefire-plugin will create 3
> new JVM processes and then execute tests from 3 modules in 3 JVM and all
> tests from a module will be running in the same JVM?



--
Cheers
Tibor

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]