Specs2:跳过继承的测试套件

Specs2: skip inherited test suite

在 specs2 中,给出以下代码:

import org.specs2.mutable.SpecificationWithJUnit

trait TestSuite extends SpecificationWithJUnit {
...
}

class ConcreteTest extends TestSuite {
  // want to skip the whole test suite here
}

如何在一个测试套件的具体测试实现中,跳过整个套件?

找到了:

import org.specs2.mutable.SpecificationWithJUnit

trait TestSuite extends SpecificationWithJUnit {
...
}

class ConcreteTest extends TestSuite {
  skipAll
}

参考:ArgumentsShortcuts

  /**
   * shortcut to skip all examples
   */
  def skipAll: Arguments = args(skipAll = ArgProperty(true))

此特征通过路径传递给 SpecificationWithJunitSpecificationWithJunit -> Specification -> SpecificationLike -> SpecificationCreation -> ArgumentsShortcuts