有没有办法截断测试结果,以便仅在单元测试失败时才显示单元测试的结果文本?我正在开发一个拥有850个单元测试的Scala项目,成功的单元测试中的绿色文本让我很难只关注失败的部分。
下面是我所说的例子:
[info] - should have colors
[info] - should not be dead
//.... x 100
[info] - animals should not be rainbows *** FAILED ***
[info] -"[rainbow]s" was not equal to "[ponie]s" (HappinessSpec.scala:31)我想要的是只显示失败的东西:
[info] - animals should not be rainbows *** FAILED ***
[info] -"[rainbow]s" was not equal to "[ponie]s" (HappinessSpec.scala:31)我知道有test-quick sbt命令,但在我的例子中,它仍然运行了300个成功的单元测试,而只有30个失败。
在用法方面与此类似的东西是我正在寻找的:
sbt> ~ test -showOnlyFailures
如果能在运行单元测试结束时显示所有的失败,我也会很高兴。这就是RSpec在Ruby中的工作方式..。
发布于 2014-02-17 22:43:02
将以下内容添加到build.sbt后,scalaTest将在标准报告后显示失败摘要:
testOptions in Test += Tests.Argument("-oI")
I - show reminder of failed and canceled tests without stack traces
T - show reminder of failed and canceled tests with short stack traces
G - show reminder of failed and canceled tests with full stack traces还有一个"drop TestSucceeded events“标志,但我没有使用它:http://www.scalatest.org/user_guide/using_the_runner
发布于 2015-07-14 01:12:57
对于那些将maven与scalatest-maven-plugin结合使用的用户,可以添加以下配置:
<configuration>
<stdout>I</stdout>
</configuration>https://stackoverflow.com/questions/21806312
复制相似问题