gpt4 book ai didi

scala - "TestsFailedException"和 "Failed 0, Errors 0"测试如何失败

转载 作者:行者123 更新时间:2023-12-01 07:37:53 24 4
gpt4 key购买 nike

间歇性地,一些 ScalaTest 测试运行失败,并出现这种矛盾的输出:

...
akka.pattern.AskTimeoutException: Timed out
at akka.pattern.PromiseActorRef$$anonfun$1.apply$mcV$sp(AskSupport.scala:334)
at akka.actor.Scheduler$$anon$11.run(Scheduler.scala:118)
at scala.concurrent.Future$InternalCallbackExecutor$.scala$concurrent$Future$InternalCallbackExecutor$$unbatchedExecute(Future.scala:694)
at scala.concurrent.Future$InternalCallbackExecutor$.execute(Future.scala:691)
at akka.actor.LightArrayRevolverScheduler$TaskHolder.executeTask(Scheduler.scala:455)
at akka.actor.LightArrayRevolverScheduler$$anon$12.executeBucket$1(Scheduler.scala:407)
at akka.actor.LightArrayRevolverScheduler$$anon$12.nextTick(Scheduler.scala:411)
at akka.actor.LightArrayRevolverScheduler$$anon$12.run(Scheduler.scala:363)
at java.lang.Thread.run(Thread.java:744)
[error] Could not run test com.example.Spec: akka.pattern.AskTimeoutException: Timed out
...
[info] ScalaTest
[info] Run completed in 20 seconds, 772 milliseconds.
[info] Total number of tests run: 64
[info] Suites: completed 12, aborted 0
[info] Tests: succeeded 64, failed 0, canceled 0, ignored 0, pending 0
[info] All tests passed.
[error] Error: Total 64, Failed 0, Errors 0, Passed 64
[error] Error during tests:
[error] com.example.Spec
[error] (price-finder/test:test) sbt.TestsFailedException: Tests unsuccessful
[error] Total time: 78 s, completed Jul 24, 2014 12:37:10 PM

如何防止这些故障?如果测试代码成功,我不希望抛出的异常导致测试运行失败。

最佳答案

ScalaTest 本身不区分错误和失败。不过,Sbt 和 JUnit 以及 specs2 一样。您是否有可能在混合中为不同的测试框架编写测试?具体来说,com.example.Spec 是什么样子的?

关于scala - "TestsFailedException"和 "Failed 0, Errors 0"测试如何失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24934790/

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