Does Maven surefire plugin run tests using multiple threads?

前端 未结 4 874
时光说笑
时光说笑 2021-01-04 01:36

I\'m wondering if the Maven surefire plugin either runs tests multi-threaded by default (and if so can the number of threads be controlled? ) or if it runs tests from the Te

4条回答
  •  鱼传尺愫
    2021-01-04 02:00

    JUnit runs tests in the order in which they appear in the .java file (not alphabetically). Maven-surefire runs them in a different order, but not predictably (as far as I can tell).

    Ideally, tests would be independent of one another, but singletons and static context can complicate things. A helpful way to get new static contexts between executions of separate TestCase's (but not individual tests) is to set the forkMode variable in your pom.xml..

    always

提交回复
热议问题