How can I make my JUnit tests run in random order?

后端 未结 5 2154
我在风中等你
我在风中等你 2020-12-06 04:16

I have the classical structure for tests, I have a test suite of different suites like DatabaseTests, UnitTests etc. Sometimes those suites contains other suites like SlowDa

5条回答
  •  天命终不由人
    2020-12-06 05:04

    This issue is open on JUnit GitHub since 2 years, and point out 2 independent issues:
    - Tests depending on the execution order;
    - Non repeatable tests.

    Consider adressing the issue at the root, rather than trying to use the framework to do the job afterwards. Use setUp and tearDown method to guarantee isolation, and test at the smallest level.

提交回复
热议问题