Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abstract state machine testing #89

Merged
merged 1 commit into from
Jun 27, 2017
Merged

Abstract state machine testing #89

merged 1 commit into from
Jun 27, 2017

Conversation

jacobstanley
Copy link
Member

@jacobstanley jacobstanley commented Jun 25, 2017

A colleague pointed me to the release of the very cool quickcheck-state-machine so I decided I'd better stop sitting on this and actually publish it!

It's still a little raw in the sense that you need to write a few boilerplate instances for your commands, and there isn't any parallel testing yet. I think parallel testing should fit in to the design without any issues however.

I rejigged the Hedgehog.Gen and Hedgehog.Range modules so they're just re-exporting from internals in order to add Gen.actions as a thing. (sorry @charleso :# ! it's all about syntax)

Here's some sample output from the two examples I've knocked together so far.

Process Registry

screen shot 2017-06-25 at 9 37 27 pm

Mutable References

screen shot 2017-06-25 at 9 37 50 pm

/cc @moodmosaic @thumphries @charleso

-- as pre-condtions, post-conditions and state updates.
--
, commandCallbacks ::
[Callback input output m state]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have mixed feelings about this. Alternatively would it be possible to provide extra constructor functions with defaults? Would that be better/worse?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not really possible to do the defaults thing because of the existentials.

I convinced myself that this is the least bad solution. I liked it because it has the benefit of being able to abstract over the functions that implement the model itself. For example if you have pre- & post-conditions which are shared between a number of commands then you can pull them out and just append it to your list.

Is it just the name which gives a bad feel? I took the callback terminology from the Erlang QuickCheck, but happy to change to something else.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, was just curious. As long as it's not just for convenience but because it's a better API, which is sounds like it is. Just ignore me. :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we'll find out! really hard to say without using it in anger, we can always change it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants