How to use scalacheck generators for generating data (not in a test)?

I am trying to populate my DB. I have written Generators for the classes. But I am not sure how to go about actually realizing the data from the generator. I don’t have any assertions here. This is purely for generating data.

val myGen: Gen[MyClass] = ???
forAll{myClass => 

But this fails to compile saying no implicit value available from ... => org.scalacheck.Prop. Is it not idiomatic to use generators for purposes other than to assert upon the generated data?

I just did this on a project using the Generator.sample method.

It will generate an Optional value of the generator type.

You can have a look at this source code from one of my PRs: search for the call to the .sample method

1 Like