Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Maven Surefire execute test cases sequentially by default?

This is a follow up to this question which I realized when I dug deeper into my research:

Is it reasonable to suppose that the Maven Surefire plugin executes test cases sequentially by default: a test case ends befores the next one starts (I'm not interested in order). I found that you can configure Surefire to run in parallel, does that mean the sequential execution is the default behavior and will likely be in the future?

NB: In case you were asking why would I want to force tests to run sequentially (I know, good tests should be able to run in parallel), it is because I'm solving a solution to a specific problem which involves coverage of a web application. You can read about it here.

Thank you

like image 830
H-H Avatar asked Nov 04 '22 15:11

H-H


1 Answers

The answer to your question involves speculating about the future, which is usually a difficult thing. Having said that, I'd make a guess that yes, it is going to be the default behaviour, because parallel execution of tests makes sense only for perfectly isolated tests, with all external dependencies mocked, or otherwise taken care of. It is sometimes hard to achieve, especially when creating tests for old code. In such cases the decision must be left to the programmer, who only has the idea whether it makes sense to employ parallelism.

like image 166
MaDa Avatar answered Nov 12 '22 12:11

MaDa