sbt 中的 ScalaTest:有没有办法在没有标签的情况下运行单个测试? [英] ScalaTest in sbt: is there a way to run a single test without tags?

查看:57
本文介绍了sbt 中的 ScalaTest:有没有办法在没有标签的情况下运行单个测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道可以通过在 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆