What are the main benefits of using Ash.Generator over StreamData?

I’m reading the Ash framework book and have come across the sections about testing with Ash.Generator. Apparently, I’ve totally missed this when creating my project and therefore I’ve written the test data using StreamData. My question is now what are the main benefits of Ash.Generator over StreamData? Is it that it provides a changeset or is there some other behind the scenes magic I’m missing? :sparkles:

Ash.Generator is actually based on StreamData, providing utilities for creating generators that produce changesets and action inputs more conveniently, as well as tools like once and sequence that are so often needing when generating data.

So you wouldn’t use Ash.Generator instead of StreamData, you’d use them together :slight_smile:

Thanks! If it is not to much to ask could you give an example on how you would use them together? (Just to improve my understanding) Or are the examples in the documentation what you mean when you say you use them together? :blush:

Yeah, primarily that’s what I mean. Individual field generators are stream data generators, and you can use utilities like StreamData.map and StreamData.bind etc.

2 Likes