gpt4 book ai didi

scala - 如何将sbt test/ScalaTest配置为仅显示失败?

转载 作者:行者123 更新时间:2023-12-03 12:13:46 29 4
gpt4 key购买 nike

有没有一种方法可以截断测试结果以仅在单元测试失败时才显示单元测试的结果文本?我正在一个具有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
在运行结束时能显示所有故障的东西我也会很满意
单元测试。 IIRC,这就是RSpec在Ruby中的工作方式...

最佳答案

在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

还有一个“丢弃TestSucceeded事件”标志,但是我无法使用它:
http://www.scalatest.org/user_guide/using_the_runner

关于scala - 如何将sbt test/ScalaTest配置为仅显示失败?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21806312/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com