This week I've been playing with altwalker, a model-based testing tool. To get the hang of it, I attempted to build a very simple model of a workflow that is supported by the service my team owns.
Hacking away at the example code, and looking frequently at the docs, I was able to get up and running in a few hours, creating:
- a basic model: nodes for system states, edges for operations
- simple assertions: mainly consistency checks on the states
- client: HTTP client to implement the operations against the service's API
I configured this so that altwalker will perform a random walk of the model, starting state data is randomised, and the client will choose randomly whenever offered an option.
Why so much randomness? Because it means that, over successive runs, more of the infinite space of possible workflow executions will be covered.
Once I had that basically working I wrote a shell script that would run this loop a number of times:
- call altwalker to run the workflow
- collect the altwalker log
- collect the altwalker console output
- collect my client's diagnostic output
With this I have the ability to generate data at scale and then explore the data for interesting behaviours.
As a first pass I ran 1000 iterations and used grep on the logs to look for runs that failed. There were around 100.
I inspected a handful and saw that they had the same pattern (one of my asserts was too specific in a particular case) so I applied grep again to remove logs with that that pattern and found that just two were left.
The first exposed a configuration error on my part, but the second appears to be a product bug found by one of my assertions. If my initial interpretation is right it would require deep technical and domain knowledge to provoke deliberately, and will be very rare in the field.
"Great shot, kid. That was one in a million" as Han Solo might say.
And it is one in a million, but not in the way he meant. The beauty of exploring with automation this way is that we can take a million shots and then find the one that hits. We can all be Luke Skywalker.
Image: https://www.youtube.com/watch?v=VhIVNWlnoes
Comments
Post a Comment