How to set custom test execution order for a test suite in JUnit5?

孤街醉人 提交于 2019-12-23 13:58:39

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!