scalaspecs2

Specs2: skip inherited test suite


In specs2, given the following code:

import org.specs2.mutable.SpecificationWithJUnit

trait TestSuite extends SpecificationWithJUnit {
...
}

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

How in concrete test implementation of a test suite, to skip the whole suite?


Solution

  • Found it:

    import org.specs2.mutable.SpecificationWithJUnit
    
    trait TestSuite extends SpecificationWithJUnit {
    ...
    }
    
    class ConcreteTest extends TestSuite {
      skipAll
    }
    

    Reference: ArgumentsShortcuts

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

    This trait is transitively inherited to SpecificationWithJunit via the path: SpecificationWithJunit -> Specification -> SpecificationLike -> SpecificationCreation -> ArgumentsShortcuts