How to pre-define the running sequences of junit test cases?

后端 未结 5 1785
无人及你
无人及你 2021-01-11 09:44

I have a test class in java and there are several methods annotated by @Test in it, somehow, i want to Junit run method A before method B when i run the whole tests. Is it p

5条回答
  •  醉话见心
    2021-01-11 10:29

    If it's only two methods then you'd need to wrap it in a single unit test that truly isn't order-dependent.

    @Test
    public void testInOrder() throws Exception {
        testA(); 
        testB(); 
    }
    

提交回复
热议问题