Skip to main content

Integration with Minitest

Minitest

Scala Hedgehog provides an integration module for minitest. This allows you to define property-based and example-based Hedgehog tests within a minitest test suite. If you use this integration, you won't need to Scala Hedgehog sbt testing extension, because you're using the one provided by minitest:

val hedgehogVersion = "0.9.0"
libraryDependencies ++= "qa.hedgehog" %% "hedgehog-minitest" % hedgehogVersion

testFrameworks += TestFramework("minitest.runner.Framework")

Here's an example of using hedgehog-minitest:

import minitest.SimpleTestSuite
import hedgehog.minitest.HedgehogSupport
import hedgehog._

object ReverseTest extends SimpleTestSuite with HedgehogSupport {
property("reverse alphabetic strings") {
for {
xs <- Gen.alpha.list(Range.linear(0, 100)).forAll
} yield xs.reverse.reverse ==== xs
}
example("reverse hello") {
"hello".reverse ==== "olleh"
}
}