Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make test parameters configurable per property #120

Open
rickynils opened this issue Nov 27, 2014 · 3 comments
Open

Make test parameters configurable per property #120

rickynils opened this issue Nov 27, 2014 · 3 comments

Comments

@rickynils
Copy link
Contributor

It would be useful to set certain test parameters (RNG, minSuccessfulTests etc) for individual properties.

@rickynils rickynils added this to the 2.0.0 milestone Nov 27, 2014
@jazmit
Copy link

jazmit commented Dec 28, 2014

+1

@rickynils rickynils self-assigned this Jan 14, 2015
@jarandaf
Copy link

+1

@howard-wang-nl
Copy link

+1

I've tried to override the mainRunner of Properties class, but the parameters are not changed as expected. What's the correct way to achieve this?

import org.scalacheck.Prop.forAll
import org.scalacheck.Test
import org.scalacheck.{Gen, Properties}
import org.scalatest.Matchers

class CoordinateTruncProp extends Properties("CoordinateTruncProperties") with Matchers  {

  override def mainRunner(args: Array[String]): Int = {
      val res = Test.checkProperties(Test.Parameters.default.withMinSize(200).withMaxSize(1000).withMinSuccessfulTests(200), this)
      val failed = res.filter(!_._2.passed).size
      failed
  }

  property("CoordinateTrunc") =
    forAll(Gen.choose(-400.0, 400.0)) { (coord) =>
      coord - truncateDoubles.truncate(coord) < 0.1
    }
...
}

@rickynils rickynils removed their assignment Nov 18, 2016
@larsrh larsrh removed this from the 2.0.0 milestone Apr 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants