【发布时间】:2020-06-18 18:17:43
【问题描述】:
我用 Future 和 Await 时间和相同的结构进行了几个 Scala 测试。测试检查一些将文件写入文件系统的方法。
我想执行严格一致的测试,每个测试都必须在之前的测试完成后开始。你能帮我找到路吗?
现在我的测试失败了,因为下一个测试无法检查结果。
class Test1 extends AsyncFunSuite with BeforeAndAfterAll with Eventually with Matchers {
test("test 1") {
// clean file system
Try(
Await.ready(
Future(TestedMethod1.run(someArgs)), 10 seconds)
)
// checking file
}
test("test 2") {
..... // the same tests
}
}
class Test2 extends AsyncFunSuite with BeforeAndAfterAll with Eventually with Matchers {
test("test 1") {
..... // the same tests
}
test("test 2") {
..... // the same tests
}
}
【问题讨论】:
标签: scala concurrency scalatest