Search code examples
javaunit-testingautomated-testsjqwik

Difference between List<Action> and ActionSequence in jqwik


What exactly is the difference in between List<Action> and ActionSequence in jqwik.

In the doc of jqwik, ActionSequence is created using Arbitraries.sequences(...) and the List<Action> is created using Arbitraries.oneOf().list()

Since the purpose of ActionSequence and List<Action> is to provide a combination of actions to run after each other.

Please guide me. Thanks :)


Solution

  • Always use ActionSequence if you want to do stateful testing. It has the Build-in capability to use an Action‘s precondition, and its shrinking behaviour is optimized for that use case. If you‘d use List<Action> instead, you would have to rebuild all that.

    In case you need an introduction of how to use it, look at https://jqwik.net/docs/current/user-guide.html#stateful-testing. More details can be found in https://blog.johanneslink.net/2018/09/06/stateful-testing/ and https://johanneslink.net/model-based-testing/.