使用 Suite.Class 可以手动构建包含许多类测试的组件,示例:
import org.junit.runner.RunWith;
import org.junit.runners.Suite;
@RunWith(Suite.class)
@Suite.SuiteClasses({
TestFeatureLogin.class,
TestFeatureLogout.class,
TestFeatureNavigate.class,
TestFeatureUpdate.class
})
public class FeatureTestSuite {
// the class remains empty,
// used only as a holder for the above annotations
}
参考资料:https://github.com/junit-team/junit4/wiki/Aggregating-tests-in-suites
网友评论