
Enumerating test cases by multiplying state machines - mathnmusic
https://medium.com/cleartax-engineering/enumerating-test-cases-by-multiplying-state-machines-c1bedbf0e8e6
======
brucou
Nice article!

I authored a javascript library which modelizes state machines as a
multidigraph, use cartesian products to derive a standard flat graph, and
generate test sequences out of it. Cf. [https://github.com/brucou/state-
transducer#generatetestseque...](https://github.com/brucou/state-
transducer#generatetestsequences--fsm_def---generators---gensettings---
arraytestcase) for the theory, here for the example :
[https://github.com/brucou/state-transducer#implementation-
ex...](https://github.com/brucou/state-transducer#implementation-example-2)

In conjunction with predicates, which tell you which edge you can explore, and
when to stop a path search (a test sequence is a path), this gives a pretty
flexible and configurable tool for automatic test generation, as you observed.

So far I preconfigured two search strategies, one which visits all transitions
in the graph once, and the second which does the same but up to n visits of
the same transition. I am working on more complex strategies (favor some paths
over some others following a probability distribution etc.) but that is not a
priority as of now.

Smart automated test generation is an exciting topic!

