On my current project, we have a group of nested case classes that I am trying to instantiate from a JSON object.
- Type A has some data plus an Option[List[B]]; mix of primitive types and compound types, with a total of 39 primitive fields in all.
- Type B has some primitive data (partly optional) plus a List[C]; total of 8 fields
- Type C has some primitive data (mostly optional) plus a List[D]; total of 21 fields
- Type D has some data, total of 16 fields
I want to assert properties of a function that accepts an argument of type A. I would like to use property-based testing, but my Gen[A] type is extremely slow. It starts out fast, but as the generated lists become longer and longer, things slow to a crawl. It takes over 3 minutes to generate a hundred samples.
Has anyone built a fast generator for large-ish JSON-ey objects before? How did you do it?