Scalatest GeneratorDrivenPropertyChecks 初始化种子

Min*_*hai 3 scala scalatest property-based-testing

我正在使用Scalatest 3.1.0-SNAP13,但无法找到如何从此PR中指定 init 种子选项。我正在使用 SBT 来运行测试,因此如果有一种方法可以指定此选项build.sbt将是理想的。

Mar*_*lic 5

-S标志似乎在 3.1.x 中被禁用:

parseLongArgument(seedArgs, "-S") match {
  case Some(seed) => // Randomizer.defaultSeed.getAndSet(Some(seed))
    println("Note: -S for setting the Randomizer seed is not yet supported.")
  case None => // do nothing
}
Run Code Online (Sandbox Code Playgroud)

不过它似乎在 3.2.x 中启用,所以尝试一下

libraryDependencies += "org.scalatest" %% "scalatest" % "3.2.0-M1" % Test
Run Code Online (Sandbox Code Playgroud)

testOptions in Test += Tests.Argument(TestFrameworks.ScalaTest, "-S", "1568769615146")
Run Code Online (Sandbox Code Playgroud)