Is this possible in JUnit4?
In JUnit3, I would do the following:
public class MyTestSuite {
public static Test suite() throws Exception {
doBeforeActions();
try {
TestSuite testSuite = new TestSuite();
for(Class clazz : getAllClassesInPackage("com.mypackage")){
testSuite.addTestSuite(clazz);
}
return testSuite;
} finally {
doAfterActions
}
}
...
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…