在ScalaTest中将AsyncWordSpec与PropertyChecks混合
我想在ScalaTest中将AsyncWordSpec与属性驱动测试混合使用 到目前为止,我有以下几点:在ScalaTest中将AsyncWordSpec与PropertyChecks混合,scala,asynchronous,scalatest,Scala,Asynchronous,Scalatest,我想在ScalaTest中将AsyncWordSpec与属性驱动测试混合使用 到目前为止,我有以下几点: class SQLPersistenceSpec extends AsyncWordSpec with Matchers with EitherValues with PropertyChecks{ ... "SQLPersistence" should { ... "insert an order" in { val persistence = H2Code
class SQLPersistenceSpec extends AsyncWordSpec with Matchers with EitherValues with PropertyChecks{
...
"SQLPersistence" should {
...
"insert an order" in {
val persistence = H2CodeRepository(h2URL)
persistence
.insertOrder(id, orderedBy, productId, freeOfCharge)
.map(_.right.value shouldBe 1)
}
...
我想创建一个基于属性的“insert a order”版本,它将id
的硬编码值替换为forAll{id:Int=>…}
构造
不幸的是,forAll
没有返回Future[Assertion]
,因此我还没有找到一种方法来组合这两种测试样式
有没有办法将AsyncWordSpec
和PropertyChecks
结合起来