-
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You should probably make this as a data-driven test instead, or split it into multiple tests. But as I said, you should most probably either split the test or make it data-driven anyway, then the second test can be checked, even if the first already failed, and then they are properly isolated. |
Beta Was this translation helpful? Give feedback.
You should probably make this as a data-driven test instead, or split it into multiple tests.
That it does not work as you expect is because you cannot override interactions like that.
The interaction from the first
when:
is still in place and is used, because it does not have any cardinality.If you want to override previous interactions, you need to do that in
then:
like described at https://spockframework.org/spock/docs/2.3/all_in_one.html#_where_to_declare_interactions.But as I said, you should most probably either split the test or make it data-driven anyway, then the second test can be checked, even if the first already failed, and then they are properly isolated.