我正在使用JUnit 4.9。这会帮助吗?:
import junit.framework.TestCase;import org.junit.AfterClass;import org.junit.BeforeClass;import org.junit.runner.RunWith;import org.junit.runners.Suite;import org.junit.runners.Suite.SuiteClasses;@RunWith(Suite.class)@SuiteClasses({First.class,Second.class,Third.class})public class RunTestSuite extends TestCase { @BeforeClass public static void doYouroneTimeSetup() { ... } @AfterClass public static void doYouroneTimeTeardown() { ... } }编辑:我非常肯定(除非我误解了您的问题),我的解决方案是您要寻找的。也就是说,在完成所有测试后,使用一种拆卸方法。不需要侦听器,JUnit具有此功能。谢谢。



