Gherkin data table equivalent in Spock framework? #2173
-
In Spock framework data driven testing, for every row in a data table the feature method will be repeated with the values in that row. To my understanding that is equivalent to Gherkins examples in a scenario outline. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
Can you please show an example of
Maybe then someone can suggest something. |
Beta Was this translation helpful? Give feedback.
-
Thank you, Björn, I meant Thank you for your answers. I will certainly apply one of them or something similar. |
Beta Was this translation helpful? Give feedback.
Ah, I see, thanks for the clarification.
Yeah, a Spock datatable is like a Gherkin Example then.
While in Spock you have more possibilities to define the "rows" than only the data table.
The
where:
is practially like theExamples:
.I don't know what you mean with "that Spock uses an
expected:
construction instead of comparablegiven:
,when:
andthen:
construction.Assuming you mean
expect:
when you sayexpected:
, then you might have misunderstood something.You can use
expect:
likeexpect: sut.calculateCount() == 1
or you can usewhen: def count = sut.calculateCount(); then: count == 1
,whether you use a data-driven feature (the ones with
where:
) or just a simple feature, and you can alwa…