gpt4 book ai didi

scala - 如果失败,如何仅显示 Scalatest 测试的标准输出

转载 作者:行者123 更新时间:2023-12-04 12:58:57 25 4
gpt4 key购买 nike

junit-interface运行者,有这个方便的选择:

-q Suppress stdout for successful tests. Stderr is printed to the console normally. Stdout is written to a buffer and discarded when a test succeeds. If it fails, the buffer is dumped to the console. Since stdio redirection in Java is a bad kludge (System.setOut() changes the static final field System.out through native code) this may not work for all scenarios. Scala has its own console with a sane redirection feature. If Scala is detected on the class path, junit-interface tries to reroute scala.Console's stdout, too.



我想知道是否有一种简单的方法可以让 scalatest 做同样的事情。我可以尝试自己重定向输出,但如果可能的话,我更愿意使用标准的东西。

最佳答案

根据这个info在 ScalaTest 网站上,您可以设置一些标志来抑制某些消息:

如果您在 build.sbt 中添加这样的行,您的记录器将不会在标准输出中显示成功的测试:
testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-oN")

关于scala - 如果失败,如何仅显示 Scalatest 测试的标准输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18063412/

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