How to disable test suite in ScalaTest

lambdas picture lambdas · Jul 17, 2012 · Viewed 17.4k times · Source

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.

Answer

Bill Venners picture Bill Venners · Jul 18, 2012

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 {
  // ...
}