I have a Play framework with a bunch of tests (which are run with ScalaTest), and I am trying to organize them by:
- Unit test
- Integration Test Read
- Integration Test Write
I have left all of my unit tests untagged, and have created the following tags:
/* TestTags.scala */
object IntegrationReadTest extends Tag("IntegrationReadTest")
object IntegrationWriteTest extends Tag("IntegrationWriteTest")
so that I can tag my integration tests like this:
/* SomeSpecs.scala */
"foo" taggedAs IntegrationReadTest in {
// External APIs are read from
}
"bar" taggedAs IntegrationWriteTest in {
// External APIs are written to
}
Most of the time while I am developing and running tests, I do not want to run the integration tests, so I modified my build.sbt
to ignore them when I run sbt test
:
/* build.sbt */
testOptions in Test += Tests.Argument("-l", "IntegrationReadTest")
testOptions in Test += Tests.Argument("-l", "IntegrationWriteTest")
This all works well, but I cannot figure how to run all of the tests (including the integration tests). I have tried many combinations of sbt test
and sbt "test:testOnly"
but can not figure out how to un-ignore the integration tests.