volia17
volia17

Reputation: 938

Unable to launch test with GeneratorDrivenPropertyChecks

I would like to use scalacheck with scalatest to test some objects with random input values. First, I tried one simple sample, but it throw an error, if i launch it via Eclipse, or via sbt. The code is :

    package test

    import org.scalatest._
    import org.scalatest.prop.GeneratorDrivenPropertyChecks
    class SamplePropGenCheck extends PropSpec with GeneratorDrivenPropertyChecks with Matchers {

      property("Int simple test") {
        forAll("a")  { a : Int =>
          whenever (a > 0) {
            (a * 2) should be (a + a)
          }
        }
      }
    }

At execution time, I have this error :

    *** RUN ABORTED ***
      java.lang.AbstractMethodError:
   org.scalatest.prop.Configuration$$anon$1.TestParams()Lorg/scalacheck/Test$Parameters$TestParams$;
      at org.scalacheck.Test$Parameters$class.$init$(Test.scala:98)
      at org.scalatest.prop.Configuration$$anon$1.<init>(Configuration.scala:332)
      at org.scalatest.prop.Configuration$class.getParams(Configuration.scala:332)

I use scalatest_2.11-2.2.1 and scalacheck_2.11-1.12.3 with scala 2.11.6

When i make an other test, with TableDrivenPropertyChecks instead of GeneratorDrivenPropertyChecks, it works well.

I don't find any help in docs or in google. Is it a code error, or a bug, or a version problem ? Is someone could help me to find a solution ?

Upvotes: 1

Views: 404

Answers (1)

biologicalturk
biologicalturk

Reputation: 66

Try downgrading to scalacheck 1.12.2.

I was seeing the same the same error with scalacheck_2.10-1.12.3. It works in scalacheck_2.10-1.12.2.

Edit: ScalaCheck 1.12.3 has a problem with ScalaTest compatibility that is fixed in 1.12.4-SNAPSHOT. https://github.com/rickynils/scalacheck/issues/165

Upvotes: 5

Related Questions