How to disable “Slow” tagged Scalatests by default, allow execution with option?

為{幸葍}努か 提交于 2019-12-02 22:16:40

I had a similar issue: I wanted to have tests that are disabled by default, but run in the release process. I solved it by creating a custom test configuration and setting testOptions in different scopes. So adapting this solution to your case, it should be something along these lines (in your build.sbt):

lazy val Slow = config("slow").extend(Test)
configs(Slow)
inConfig(Slow)(Defaults.testTasks)

Now by default exclude slow tests:

testOptions in Test += Tests.Argument("-l", "org.scalatest.tags.Slow")

But in the Slow scope don't exclude them and run only them:

testOptions in Slow -= Tests.Argument("-l", "org.scalatest.tags.Slow")
testOptions in Slow += Tests.Argument("-n", "org.scalatest.tags.Slow")

Now when you run test in sbt, it will run everything except slow test and when you run slow:test it will run only slow tests.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!