Specifying an order to junit 4 tests at the Method level (not class level)

前端 未结 6 2139
醉酒成梦
醉酒成梦 2020-12-02 10:50

I know this is bad practice, but it needs to be done, or I\'ll need to switch to testng. Is there a way, similar to JUnit 3\'s testSuite, to specify the order o

6条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 11:01

    From JUnit version 4.11 onwards, it is possible to influence the order of test execution by annotating your class with @FixMethodOrder and specifying any of the available MethodSorters. See this link for more details.

提交回复
热议问题