Chapter 3. A tour of Spock functionality

This chapter covers

  • Understanding the given-when-then Spock syntax
  • Testing datasets with data-driven tests
  • Introducing mocks/stubs with Spock
  • Examining mock behavior

With the Groovy basics out of the way, you’re now ready to focus on Spock syntax and see how it combines several aspects of unit testing in a single and cohesive package.

Different applications come with different testing needs, and it’s hard to predict what parts of Spock will be more useful to you beforehand. This chapter covers a bit of all major Spock capabilities to give you a bird’s-eye view of how Spock works. I won’t focus on all the details yet because these are explained in the coming chapters.

The purpose of this chapter is to ...

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.