Search code examples
scalatestingscalatest

How to disable test suite in ScalaTest


How to disable a test suite, i.e. all tests inside class extending FunSpec?

The only solution I'd found is to replace it with ignore in front of each test, but it is boring to do so with the dozens of tests.


Solution

  • The easy way to do this in 1.8 is to add a constructor that takes a dummy argument. ScalaTest (and sbt) won't discover the class if it doesn't have a public, no-arg constructor:

    class MySuite(ignore: String) extends FunSuite { 
      // ...
    }
    

    In 2.0 you'll be able to just write @Ignore on the class:

    @Ignore
    class MySuite extends FunSuite {
      // ...
    }