ScalaTest in sbt: is there a way to run a single test without tags? Ask Question

ScalaTest in sbt: is there a way to run a single test without tags? Ask Question

I know that a single test can be ran by running, in sbt,

testOnly *class -- -n Tag

Is there a way of telling sbt/scalatest to run a single test without tags? For example:

testOnly *class -- -X 2

it would mean "run the second test in the class. Whatever it is". We have a bunch of tests and no one bothered to tag them, so is there a way to run a single test without it having a tag?

ベストアンサー1

This is now supported (since ScalaTest 2.1.3) within interactive mode:

testOnly *MySuite -- -z foo

to run only the tests whose name includes the substring "foo".

For exact match rather than substring, use -t instead of -z.


If you run it from the command line, it should be as single argument to sbt:

sbt 'testOnly *MySuite -- -z foo'

おすすめ記事