我在尝试从sbt
运行所有测试时遇到了很多挫折 - 同时排除了特定标记。这是我想要运行的:
testOnly * -- -l "com.my.project.path.tags.ValidationTest"
我已尝试过此命令的许多变体,包括将*
替换为类的路径或类似的路径:
testOnly "com.my.project.path.somePackage" -- -l "com.my.project.path.tags.ValidationTest"
我已尝试在包装周围使用和不使用引号。
我刚刚读到新版testOnly
而不是sbt
使用了test-only
。我已经尝试过这种语法(以及许多变体),似乎没有任何效果。
我的测试设置如下:
"some method" should "fail when doing something" taggedAs ValidationTest in { ... }
我在object ValidationTest extends Tag("com.my.project.path.tags.ValidationTest")
中定义了TestTag.scala
。
当使用it
关键字定义方法而不是"some method" should "fail..."
Sbt with ScalaTest在“包含和排除带有标记的测试”下显示以下内容
> 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"
答案 0 :(得分:0)
只是几个猜测:
testOnly com.my.project.* -- -l "com.my.project.path.tags.ValidationTest"
)it:testOnly * -- -l "path.to.Tag"
。