I am doing stateful testing using Jqwik. The problem I am facing is as follows:
The action chain contains a set of state dependent actions that can produce empty Arbitraries (example: no "pop" action should be produced for an empty stack). Some actions are state independent and are always "productive" (like "push" a value on the stack).
The issue is that action chains are generated randomly and sometimes only non-productive actions are selected which in turn produces empty chains and ends up in the net.jqwik.api.JqwikException: empty set of values.
Increasing weight on "productive" actions mitigates the issue but does not solve it.
Is there a way to make sure at least one "productive" action is always selected and hence the generated action chain is always non-empty?
I've tried to use ActionChain.independent() with endOfChain() transformer but it did not help.
As mentioned by johanneslink - I should implement Action.precondition() for this purpose. Thanks.