5.3. Using data pipes for calculating input/output parameters
Data tables should be your bread and butter when writing Spock parameterized tests. They shine when all input and output parameters are known in advance and thus can be embedded directly in the source code.
But sometimes the test parameters are computed on the spot or come from an external source (typically a file, as you’ll see later in this chapter). For those cases, using data pipes is a better option. Data pipes are a lower-level construct of Spock parameterized tests that can be used when you want to dynamically create/read test parameters.[8]
Data tables can be seen as an abstraction over data pipes.
As a first example, let’s rewrite the first data table code of listing ...
Get Java Testing with Spock now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.