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

为什么scalatest混合输出?

发布时间:2020-12-16 09:09:55 所属栏目:安全 来源:网络整理
导读:我从sbt运行我的 scalatest,输出混合 – scalatest打印所有的测试运行,并给他们评论,在中间的某个地方打印统计数据: test[info] Compiling 1 Scala source to /home/platon/Tor/scala-dojo-02/target/scala-2.9.1/classes...[info] FunsWithListsTests:[inf
我从sbt运行我的 scalatest,输出混合 – scalatest打印所有的测试运行,并给他们评论,在中间的某个地方打印统计数据:

> test
[info] Compiling 1 Scala source to /home/platon/Tor/scala-dojo-02/target/scala-2.9.1/classes...
[info] FunsWithListsTests:
[info] - should return list of labels
[info] - should return the average rating of games belonging to Zenga
[info] - should return the total ratings of all games
[info] - should return the total ratings of EA games *** FAILED ***
[info]   0 did not equal 170 (FunsWithListsTests.scala:35)
[error] Failed: : Total 8,Failed 5,Errors 0,Passed 3,Skipped 0
[info] - should increase all games rating by 10 *** FAILED ***
[error] Failed tests:
[error]     dojo.FunsWithListsTests
[info]   List() did not equal List(Game(Activision,40),Game(Zenga,70),20),Game(EA,120)) (FunsWithListsTests.scala:40)
[info] - should decrease all Zenga games rating by 10 *** FAILED ***
[info]   List() did not equal List(Game(Activision,30),50),0),60),110)) (FunsWithListsTests.scala:45)
[info] - should create function to find Activision games *** FAILED ***
[info]   List(Game(Activision,10),110)) did not equal List(Game(Activision,30)) (FunsWithListsTests.scala:50)
[info] - should return a List of tuples consisting of game label and game *** FAILED ***
[info]   List() did not equal List((ACTIVISION,Game(Activision,30)),(ZENGA,60)),10)),(EA,110))) (FunsWithListsTests.scala:56)
[error] {file:/home/platon/Tor/scala-dojo-02/}default-940f03/test:test: Tests unsuccessful
[error] Total time: 1 s,completed Mar 20,2012 9:27:13 AM

看来如果我会积累大量的测试,搜索这些统计数据和失败的测试将会变得很痛苦.

有没有办法来解决这个问题?

解决方法

它看起来我的原因是,SBT默认执行测试并行,与maven-surefire-plugin一样.

正如在ScalaTest wiki中所解释的,这可以通过以下方式解决:

禁止并行执行测试
默认情况下,sbt并行运行所有任务.因为每个测试都映射到一个任务,所以测试也默认并行运行.禁用并行执行测试:

在测试中的parallelExecution:= false

(编辑:李大同)

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

    推荐文章
      热点阅读