5

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

Community
  • 1
  • 1
H-H
  • 4,431
  • 6
  • 33
  • 41
  • 1
    Yes, the tests are by default run one by one. Why don't you just test it? – JB Nizet Sep 01 '11 at 10:21
  • I tested it, but I want to make sure it will always work like that on any environement (multicore or not) – H-H Sep 01 '11 at 10:25

1 Answers1

2

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.

Aravind Yarram
  • 78,777
  • 46
  • 231
  • 327
MaDa
  • 10,511
  • 9
  • 46
  • 84
  • as you can specify which version of the surefire plugin you choose to use, the speculation of the future need not be a great concern :) – Brett Porter Sep 01 '11 at 14:47