问题
I have a large set of tests on JUnit5, which I run in parallel in several threads. There is also information about the time of each test. I want to run at the beginning of the longest tests, and leave the fastest at the end to optimize common execution time.
I have not found a way to do this in JUnit5.
In version 5.4
there is an org.junit.jupiter.api.MethodOrderer
interface which allows you to write a test sorter within a test class. And connect to the test class via the annotation org.junit.jupiter.api.TestMethodOrder
.
I would like something similar, but globally, for the whole test suite.
回答1:
What you're asking for is unfortunately not currently possible in JUnit 5 (i.e., either on the JUnit Platform or within JUnit Jupiter).
There is however an open issue dedicated to this topic. So feel free to chime in there.
来源:https://stackoverflow.com/questions/55632208/how-to-set-custom-test-execution-order-for-a-test-suite-in-junit5