JUnit套件测试(共通类测试)

Posted on 2020-02-23 23:26  wzhw2015  阅读(161)  评论(0编辑  收藏  举报
@RunWith(Suite.class)
@Suite.SuiteClasses({ TestClass1.class, TestClass2.class })
public class SuiteTest {
}
 
@RunWith(Suite.class)
@Suite.SuiteClasses({ TestClass3.class, TestClass5.class })
public class TestClass1 {
}
 
@RunWith(Suite.class)
@Suite.SuiteClasses({ TestClass4.class, TestClass5.class })
public class TestClass2 {
}
 
public class TestClass3 {

@Test
public void test3() {
System.out.println("3");
}
}
 
public class TestClass4 {

@Test
public void test4() {
System.out.println("4");
}
}
 
public class TestClass5 {

@Test
public void test5() {
System.out.println("5");
}
}
 
实行结果:
3
5
4
5

Copyright © 2024 wzhw2015
Powered by .NET 9.0 on Kubernetes