How to parameterize junit Test Suite

后端 未结 7 1892
梦毁少年i
梦毁少年i 2021-01-14 06:42

Is it possible to parameterize a TestSuite in junit 4 ?

For declaring a class as a test suite I need the annotation @RunWith(Suite.class), but the same

7条回答
  •  悲&欢浪女
    2021-01-14 07:08

    the best solution will be, keep suit classes separately in a blank class. For example, I am testing logins as Parameterized tests and putting in a suit (for navigation performance measurement)

         @RunWith(Suite.class)
    @Suite.SuiteClasses({
                LoginPageTest.class,
                HomePageTests.class})
        public class PerformanceTests {
        }
    

    and LoginPageTest is actually Parameterizedtests

    @RunWith(Parameterized.class)
    public class LoginPageTest
    {...}
    

提交回复
热议问题