在所有junit测试之后进行清理

在所有junit测试之后进行清理,第1张

在所有junit测试之后进行清理

我正在使用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具有此功能。谢谢。



欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/5016703.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-14
下一篇2022-11-14

发表评论

登录后才能评论

评论列表(0条)

    保存