sbt 中的 ScalaTest:有没有办法在没有标签的情况下运行单个测试? [英] ScalaTest in sbt: is there a way to run a single test without tags?
问题描述
我知道可以通过在 sbt 中运行来运行单个测试
I know that a single test can be ran by running, in sbt,
testOnly *class -- -n Tag
有没有办法告诉 sbt/scalatest 运行没有标签的单个测试?例如:
Is there a way of telling sbt/scalatest to run a single test without tags? For example:
testOnly *class -- -X 2
这意味着在课堂上运行第二个测试.不管它是什么".我们有一堆测试,但没人费心去标记它们,那么有没有办法在没有标记的情况下运行单个测试?
it would mean "run the second test in the class. Whatever it is". We have a bunch of tests and no one bothered to tag them, so is there a way to run a single test without it having a tag?
推荐答案
现在在交互模式下支持(自 ScalaTest 2.1.3 起):
This is now supported (since ScalaTest 2.1.3) within interactive mode:
testOnly *MySuite -- -z foo
仅运行名称包含子字符串foo"的测试.
to run only the tests whose name includes the substring "foo".
对于精确匹配而不是子字符串,使用 -t
而不是 -z
.
For exact match rather than substring, use -t
instead of -z
.
这篇关于sbt 中的 ScalaTest:有没有办法在没有标签的情况下运行单个测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!