用suites做套件测试

使用Suite作为runner,你可以手动创建一个包含多个类的测试套件.相当于JUint 3.8.x的 static test suite()方法.使用@RunWith(Suite.class)@SuiteClasses(TestClass1.class, ...)注解,当你运行该类的时候,它可以运行所有的SutieClasses指定的类

例子

如下所示,该类是suite注解的一个演示,它不需要实现其他内容.注意@RunWith注解,它指定了JUnit 4运行是使用org.junit.runners.Suite来执行这个特定的测试类,它结合@Suite注解,告诉Suite runner该套件包含哪些测试类及顺序。

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
}
Copyright © www.gitbook.com/@herryZ 2016 all right reserved,powered by Gitbook该文件修订时间: 2017-03-13 05:37:11

results matching ""

    No results matching ""