引入一种“测试套件”的概念:
package test; import org.junit.Test; public class Test1 { private int value = 1; public void function(){ System.out.println(value); } @Test public void test1(){ function(); } }
package test; import org.junit.Test; public class Test2 { private int value = 2; public void function(){ System.out.println(value); } @Test public void test(){ function(); } }
package test; import org.junit.runner.RunWith; import org.junit.runners.Suite; import org.junit.runners.Suite.SuiteClasses; @RunWith(Suite.class) @SuiteClasses({ Test1.class, Test2.class }) public class SuitTest { }
时间: 2024-10-13 15:38:22