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

Additional feature? State-machine-based property testing #42

Open
ccol002 opened this issue Mar 8, 2018 · 2 comments
Open

Additional feature? State-machine-based property testing #42

ccol002 opened this issue Mar 8, 2018 · 2 comments

Comments

@ccol002
Copy link

ccol002 commented Mar 8, 2018

For a number of years, I have been on the lookout for a Java QuickCheck tool supporting state-machine-based properties.

For example http://www.quviq.com/products/erlang-quickcheck/ and http://proper.softlab.ntua.gr/Tutorials/PropEr_testing_of_finite_state_machines.html, and http://www.cs.waikato.ac.nz/~marku/mbt/modeljunit/ offer the possibility of specifying properties in terms of finite state machines. This is very convenient when the property being tested has elements of control-flow, e.g.: every time a newly registered user performs a call to "withdraw" before a call to "deposit" is marked as suspicious.

The idea is to have pre and post conditions on each machine transition such that the test is a traversal of the state machine which satisfies the preconditions, checking the satisfaction of the postconditions as the test progresses.

Are there any plans to support such functionality please?

@hcoles
Copy link
Contributor

hcoles commented Mar 8, 2018

There is in fact some support for something similar already built in, although it is completely undocumented as it is somewhat experimental.

It's loosely based on scalacheck's stateful testing - so it is not tied to state machines, but it does let you compare the behaviour of your system to a model which could be a state machine.

The nearest thing to documentation is the example test.

https://github.com/ncredinburgh/QuickTheories/blob/master/core/src/test/java/com/example/StatefulTest.java

@ccol002
Copy link
Author

ccol002 commented Mar 9, 2018

That's great to know! Hope there will be more of this in the future :)

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

No branches or pull requests

2 participants