I'm having a lot of frustration trying to run all my tests from sbt
- while excluding a specific tag. Here is what I am trying to run:
testOnly * -- -l "com.my.project.path.tags.ValidationTest"
I've tried many variations of this command, including replacing the *
with the path to a class or the path to a package like so:
testOnly "com.my.project.path.somePackage" -- -l "com.my.project.path.tags.ValidationTest"
And I've tried with and without quotes around the package.
I just read that testOnly
is used in the new version of sbt
and not test-only
. I've tried this syntax (and many variations), and nothing seems to work.
I have my tests set up like this:
"some method" should "fail when doing something" taggedAs ValidationTest in { ... }
I have object ValidationTest extends Tag("com.my.project.path.tags.ValidationTest")
defined in TestTag.scala
.
I have also attempted this when the method is defined with the it
keyword, instead of "some method" should "fail..."
Sbt with ScalaTest shows the following under "Include and Exclude Tests with Tags"
> test-only org.acme.* -- -n CheckinTests
> test-only org.acme.* -- -n FunctionalTests -l org.scalatest.tags.Slow
> test-only org.acme.* -- -n "CheckinTests FunctionalTests" -l "org.scalatest.tags.Slow org.scalatest.tags.Network"
-n
or-l
flags. See here: ScalaTest with Sbt. See 3/4 down on the page. – Sheila