If you want to disable certain types of tests with Scala you can use tags.
To disable specific test cases you can use
taggedAs method in the test declaration along with certain
Tag object. For instance
SlowTest like below.
Then you can exclude the specific tagged tests with a parameter passed to
testOnly task in
sbt "testOnly * -- -l com.dmydlarz.playground.SlowTest"
If you want to disable all tests in a class, including
afterAll method, you can use old good (or bad?) Java annotation.
And place it on the desired specs.
Now just pass the annotation full name to
testOnly task as exclude parameter.
sbt "testOnly * -- -l tags.LocalOnly"
Two things to be aware:
- Always use full package name when excluding the tests withing sbt command.
- Do not forget to double quote the phrase
testOnly * -- -l <tag>. Otherwise it will not run as you expect it.