I'm trying to build a stateful test generator for a FSM. It should pick a random edge given the current state. Is there anything wrong with keeping state inside with-gen
's generator? I
want to be able to get an output of the transitions generated so i can step through the FSM. I
quickly read through https://github.com/czan/stateful-check and I dont see an easy way to output the commands, where i assume the transitions would be, though according to the docs, this data is probably available somewhere.
Keeping state in the generator would be strange, especially with shrinking
I don't know enough about stateful-check to comment on the rest
Other than to say that your use case sounds like exactly what it's targeting, so it'd be surprising if you couldn't make it work
> especially with shrinking That's what i assumed, thanks @gfredericks.
> It should pick a random edge given the current state Do you happen to be using directed, acyclic graphs? If so I’d be very interested in learning more about the kind of thing you’re testing. It’s why I built https://github.com/nwjsmith/generators.graph
@nwjsmith I was working on the idea of how to make software systems more understandable. I think, for the most part, frameworks almost always make this harder (a claim i can't justify right now), but i think we should be able to design systems such that when we do want to create a framework/mental modal from our code, such that it gives us a useful abstraction for understanding the problem, we should be able to do that. As part of that, I was thinking that being able to take a codebase/system and extract a statemachine view over top of it, to model say, only user interactions, then generating other user interactions would be one powerful way to view how your system behaves. As part of that, I had thought to generate the user-inputs using test-check, though for my current acadamic purpose i can also just create something without the shrinking and other benfiets, though a real version would want them. > Do you happen to be using directed, acyclic graphs? In this case i think it would be more useful for the modal to include cycles. Honestly, it would depend on what your trying to discover, so the path walking wouldn't be prescriptive, a chaotic user might simply login and logout 1000 times. A normal user might be built using data from normal users to train a AI. Forcing your system to be acyclic would probably force the interaction path to hit edges faster, rather then looping around? idk.
Ah, I see. This gives me a few ideas for additions to generators.graph
actually, especially WRT cyclic graphs and paths. Thanks!