Ordering unit tests in Eclipse's JUnit view

后端 未结 7 1500
不知归路
不知归路 2020-12-29 01:58

The JUnit view in Eclipse seems to order the tests randomly. How can I order them by class name?

7条回答
  •  既然无缘
    2020-12-29 02:12

    mark wrote:

    it orders them base on execution time, maybe you should sort your methods? source/sort members

    mark is right. But you cannot sort your unit test. It's not allowed to speculate about the order of execution.

    Unit tests have to be built independently and it's random, how they are called by the UnitRunner.

    In most cases, the test methods are sorted alphabetically. The classes are random. Try to use a TestSuite to order your tests.

提交回复
热议问题