How to run test methods in order with Junit

后端 未结 4 1817
一生所求
一生所求 2021-01-12 04:34

I am using JUnit and Selenium Webdriver. I want to run my test methods in order as how I write them in my code, as below:

@Test
public void registerUserTest(         


        
4条回答
  •  独厮守ぢ
    2021-01-12 05:01

    You can not run your test methods in order as how they are written. The point is test must be independent each other. JUnit doesn't encourage dependent tests.

    But if you are very want...

    There is the @FixMethodOrder annotation. Please, read the following Annotation Type FixMethodOrder

提交回复
热议问题