public class MyTestSuite extends TestCase {
public MyTestSuite () {
super();
}
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTest(new JUnit4TestAdapter(A.class));
suite.addTest(new JUnit4TestAdapter(B.class));
TestSetup wrapper = new TestSetup(suite) {
@Before
protected void setUp() throws LTFSLEBaseException, Exception {
oneTimeSetUp();
}
@After
protected void tearDown() throws LTFSLEBaseException, Exception {
oneTimeTearDown();
}
};
return wrapper;
}
protected static void oneTimeSetUp() {
}
protected static void oneTimeTearDown(){
}TestSuite创建方式(一)
最新推荐文章于 2024-09-25 08:13:02 发布
本文介绍了一个使用 JUnit 框架创建测试套件的示例代码。该示例展示了如何通过 TestSuite 类组织多个测试类,并利用 TestSetup 进行一次性的 setUp 和 tearDown 操作。
1224

被折叠的 条评论
为什么被折叠?



