Part 2. Structuring Spock tests

This part contains the principal Spock knowledge. With the foundations out of the way, you’re ready to see the Spock syntax in all its glory, particularly the different parts of a Spock unit test and how they can be combined for various cases.

Chapter 4—the central chapter of the whole book—shows the individual parts of a Spock unit test (which are called blocks), their purpose, significance, and expected structure. This chapter also explains the lifecycle of a Spock test, the documentation annotations, and the facilities offered by Spock that affect the readability of a unit test. Make sure that you’ve mastered the topics of this chapter before moving on to the rest of the book.

Chapter 5 focuses on parameterized ...

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.