0

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 :)

johanneslink
  • 4,877
  • 1
  • 20
  • 37
Sagar Khurana
  • 184
  • 1
  • 2
  • 11
  • ActionSequence has methods specific to running all those actions on it, while a List must be iterated item-by-item. – Michael Jun 29 '22 at 14:00
  • @Michael What you mentioned is right but it's about how the client uses it, other than that do you know any impactful point? like when to choose which one? or both are just the same but different data type – Sagar Khurana Jun 29 '22 at 15:16

1 Answers1

1

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/.

johanneslink
  • 4,877
  • 1
  • 20
  • 37