小编Spy*_*der的帖子

如何在JUnit 4.x中创建嵌套的TestSuite?

我正在尝试将JUnit添加到一个大型项目中,并且在嵌套测试套件时遇到了困难.例如:

@RunWith(Suite.class)
@Suite.SuiteClasses({Test2.class, .....})
public class Test1{
}

@RunWith(Suite.class)
@Suite.SuiteClasses({Test3.class, .....})
public class Test2{
  //might have tests
}

@RunWith(Suite.class)
public class Test3{
  //tests here
}
Run Code Online (Sandbox Code Playgroud)

每个类在它自己的包中运行测试,以及所有子包TestSuite

运行Test1会导致java.lang.Exception:没有可运行的方法.我如何让它工作?有没有更好的方法来组织测试而没有一个没有巨大的列表?

java junit junit4 test-suite

6
推荐指数
1
解决办法
3820
查看次数

标签 统计

java ×1

junit ×1

junit4 ×1

test-suite ×1