I'm trying to use ScalaTest's tagging feature to limit the scope of tests run in a test suite. Unfortunately it's not working at all; any syntax I've tried simply results in no tests at all running.
import org.scalatest.tagobjects._
"Ship service" should {
"return to port" taggedAs(Slow) in {
whenReady(client.getShip(shipId).invoke()) { ship =>
whenReady(client.dock(ship.id).invoke()) { response =>
response should be(Done)
}
}
}
}
I've also tried using "return to port" taggedAs(org.scalatest.tagobjects.Slow)
but it makes no difference.
When I try to run only the Slow
test in SBT, no tests run:
sbt:ship-service> testOnly "com.acme.ship.ShipSpec -- -n org.scalatest.tagobjects.Slow"
[info] ScalaTest
[info] Run completed in 13 milliseconds.
[info] Total number of tests run: 0
[info] Suites: completed 0, aborted 0
[info] Tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0
[info] No tests were executed.
I've also tried:
sbt:ship-service> testOnly "com.acme.ship.ShipSpec -- -n Slow"
sbt:ship-service> testOnly com.acme.ship.ShipSpec -- -n Slow
No difference on the first one. On the second one (without quotes) every tests run, regardless of the tag applied (so all tests, included untagged and tagged).
Assuming you are using org.scalatest.tagobjects.Slow
than it is implemented as object Slow extends Tag("org.scalatest.tags.Slow")
so you need to execute testOnly com.acme.ship.ShipSpec -- -n org.scalatest.tags.Slow
or define your own tags fe: case object Slow extends Tag("Slow")