加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何失败,如何只显示最新测试的stdout

发布时间:2020-12-16 19:14:12 所属栏目:安全 来源:网络整理
导读:有了 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 con
有了 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做同样的事情.我可以尝试自己重定向输出,但如果可能的话,我更愿意使用标准的东西.

解决方法

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

如果你在build.sbt中添加这样的一行,你的记录器将不会在stdout中显示成功的测试:

Test中的testOptions = Tests.Argument(TestFrameworks.ScalaTest,“ – oN”)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读