How to run test methods in specific order in JUnit4?

后端 未结 18 1839
伪装坚强ぢ
伪装坚强ぢ 2020-11-22 04:35

I want to execute test methods which are annotated by @Test in specific order.

For example:

public class MyTest {
    @Test public void          


        
18条回答
  •  盖世英雄少女心
    2020-11-22 05:03

    I ended up here thinking that my tests weren't run in order, but the truth is that the mess was in my async jobs. When working with concurrency you need to perform concurrency checks between your tests as well. In my case, jobs and tests share a semaphore, so next tests hang until the running job releases the lock.

    I know this is not fully related to this question, but maybe could help targeting the correct issue

提交回复
热议问题