i'm trying make sure scalacheck property runs 500 times instead of default 100 times. i'm having trouble configuring though.
class blockspec extends properties("blockspec") bitcoinslogger { val myparams = parameters.default.withminsuccessfultests(500) override def overrideparameters(p: test.parameters) = myparams property("serialization symmetry") = prop.forall(blockchainelementsgenerator.block) { block => logger.warn("hex:" + block.hex) block(block.hex) == block } }
however when run test says 100 tests passed successfully
edit:
$ sbt [info] loading project definition /home/chris/dev/bitcoins-core/project [info] set current project bitcoin-s-core (in build file:/home/chris/dev/bitcoins-core/) > test-only *blockspec* [info] + blockspec.serialization symmetry: ok, passed 100 tests. [info] elapsed time: 1 min 59.775 sec [info] scalacheck [info] passed: total 1, failed 0, errors 0, passed 1 [info] scalatest [info] run completed in 2 minutes. [info] total number of tests run: 0 [info] suites: completed 0, aborted 0 [info] tests: succeeded 0, failed 0, canceled 0, ignored 0, pending 0 [info] no tests executed. [info] passed: total 1, failed 0, errors 0, passed 1 [success] total time: 123 s, completed aug 1, 2016 11:36:17 >
how pass property?
as far understand can specify test parameters @ 2 levels , don't seem communicate.
the first option within property you're trying do:
import org.scalacheck.properties import org.scalacheck.test.{ testcallback, parameters } import org.scalacheck.prop.{ forall, booleanoperators } import org.scalacheck.test class testfoo extends properties("blockspec") { override def overrideparameters(p: parameters) = p.withminsuccessfultests(1000000) property("serialization symmetry") = forall { n: int => (n > 0) ==> (math.abs(n) == n) } }
this have no impact long don't call .check
on property. can sbt shell or directly within class.
now if want impact number of tests run when calling sbt:test
target, seems have play options build.sbt
(taken here):
name := "scalacheck-demo" scalaversion := "2.11.5" librarydependencies += "org.scalacheck" %% "scalacheck" % "1.12.2" % "test" testoptions in test += tests.argument(testframeworks.scalacheck, "-maxsize", "5", "-minsuccessfultests", "33", "-workers", "1", "-verbosity", "1")
Comments
Post a Comment