[英]Exclude Specifically Tagged tests from SBT when using ScalaTest
我试图从sbt
运行我的所有测试时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..."
使用ScalaTest的Sbt在“ 包含和排除带有标记的测试 ”下显示以下内容
> 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"
只是几个猜测:
testOnly com.my.project.* -- -l "com.my.project.path.tags.ValidationTest"
) it:testOnly * -- -l "path.to.Tag"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.