heinkunibert
heinkunibert

Reputation: 361

Threaded Maven builds with sequential Unit Tests?

With Maven 3 it`s possible to build Projects with multiple Threads, like

mvn -T 4 clean install

Since we have Unit-Tests setting up on a consistent Database (and manipulating the data during execution), we need to make sure, that these Unit Tests are not running in parallel execution. I know that there is a configuration-option for Maven-Surefire-Plugin to execute Tests sequentially or enable parallel execution:

<configuration>
   <parallel>classes</parallel>
</configuration>

When I leave this configuration empty Tests should be executed sequentially, right? But is execution still sequentially when calling the Build with multiple Maven-Threads (-T) like above?

Upvotes: 0

Views: 2390

Answers (2)

wilson
wilson

Reputation: 163

I think what you're looking for might be here. It's about how surefire forks and or runs parallel threads.

Upvotes: 0

Raghuram
Raghuram

Reputation: 52665

As far as I understand and from the documentation, parallel build runs modules in parallel and not the goals within each module. That being the case, the unit tests in a module will run sequentially unless configured in surefire to run in parallel.

Upvotes: 1

Related Questions