Skip to content

Gherkin data table equivalent in Spock framework? #2173

Answered by Vampire
HaaiHenkie asked this question in Q&A
Discussion options

You must be logged in to vote

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 the Examples:.

I don't know what you mean with "that Spock uses an expected: construction instead of comparable given:, when: and then: construction.
Assuming you mean expect: when you say expected:, then you might have misunderstood something.

You can use expect: like expect: sut.calculateCount() == 1 or you can use when: 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…

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@HaaiHenkie
Comment options

@HaaiHenkie
Comment options

@Vampire
Comment options

Vampire Jun 5, 2025
Collaborator

Answer selected by HaaiHenkie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants