You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into an example, where the Command API delivers a Command Sequence after shrinking, in which not all preconditions are satisfied, although I thought this is impossible. In the example I define the operations Op1, Op2 and Op3. Op1 can always be executed, Op2 can only be executed when Op1 has already been executed and Op3 can be executed when Op2 has been executed previously. The definition of the SUT is irrelevant for this demonstration. Op3 is defined to always fails, so Op1 -> Op2 -> Op3 is a counter example. However, after shrinking Op2 -> Op3 is returned. The example is implemented as follows:
The original counter example is Op1 -> Op2 -> Op3, which is the minimal sequence to run into the error.
However, after shrinking the counter example is Op2 -> Op3, which is impossible, as the precondition of Op2 is not satisfied initially. I would expect this behaviour if initialPreCondition was omitted, however it is defined that op1wasExecuted is false initially. Therefore, a counter example without Op1 does not make sense to me.
Have I misunderstood something about the way ScalaCheck works, or is this unintentional behaviour?
A workaround for this example would be to change the precondition of Op3 to state.op1wasExecuted && state.op2wasExecuted.
The text was updated successfully, but these errors were encountered:
I ran into an example, where the Command API delivers a Command Sequence after shrinking, in which not all preconditions are satisfied, although I thought this is impossible. In the example I define the operations
Op1
,Op2
andOp3
.Op1
can always be executed,Op2
can only be executed whenOp1
has already been executed andOp3
can be executed whenOp2
has been executed previously. The definition of theSUT
is irrelevant for this demonstration.Op3
is defined to always fails, soOp1 -> Op2 -> Op3
is a counter example. However, after shrinkingOp2 -> Op3
is returned. The example is implemented as follows:ScalaCheck gives the following output:
The original counter example is
Op1 -> Op2 -> Op3
, which is the minimal sequence to run into the error.However, after shrinking the counter example is
Op2 -> Op3
, which is impossible, as the precondition ofOp2
is not satisfied initially. I would expect this behaviour ifinitialPreCondition
was omitted, however it is defined thatop1wasExecuted
is false initially. Therefore, a counter example withoutOp1
does not make sense to me.Have I misunderstood something about the way ScalaCheck works, or is this unintentional behaviour?
A workaround for this example would be to change the precondition of
Op3
tostate.op1wasExecuted && state.op2wasExecuted
.The text was updated successfully, but these errors were encountered: