Part 1. Foundations and brief tour of Spock

Spock is a test framework that uses the Groovy programming language. The first part of the book expands on this by making sure that we (you, the reader, and me, the author) are on the same page.

To make sure that we are on the same page in the most gradual way, I first define a testing framework (and why it’s needed) and introduce a subset of the Groovy syntax needed for writing Spock unit tests. I know that you’re eager to see Spock tests (and write your own), but some features of Spock will impress you only if you’ve first learned a bit about the goals of a test framework and the shortcomings of current test frameworks (for example, JUnit).

Don’t think, however, that this part of the book is theory ...

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.