scalatest 中是否有任何东西会等待一段时间才能使断言变为 true?
因此,例如,如果我有一个异步计算某些内容的线程,我想在测试中等待计算等于预期值。
最佳答案
您最有可能最终想要:
https://www.scalatest.org/scaladoc/3.2.6/org/scalatest/concurrent/Eventually.html
但是如果您的计算是在 future 内进行的,您可能会想要使用 Future 子特征之一:
https://www.scalatest.org/scaladoc/3.2.6/org/scalatest/concurrent/Futures.html
关于Scalatest:WAITING断言变为真,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24587693/