O'Reilly logo

Java Testing with Spock by Konstantinos Kapelonis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 5. Parameterized tests

This chapter covers

  • Definition of parameterized tests
  • Using the where: block
  • Understanding data tables and data pipes
  • Writing custom data providers

The previous chapter presented all the Spock blocks that you can use in a unit test, except for one. I left out the where: block on purpose because it deserves a chapter of its own. The where: block is used for parameterized tests. Parameterized tests are unit tests that share the same test logic (for example, when the temperature goes up, the reactor must shut down), but need to run on different parameters (for example, with low temperature and then with high temperature) in order to account for all cases.

This chapter covers both some theory on when to use ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required