Spock tests

The Spock Framework is a behavior-driven development (BDD) tool built on top of JUnit. Spock uses the features of the Groovy language to add BDD style syntax to JUnit tests. Spock allows us to write our test specifications as "given, when, then" style expressions, but under the covers, they still run as JUnit tests and can still be run by the JUnit runner. This means that Spock tests are compatible with most build tools, IDEs, and continuous integration servers.

Given, when, then

The main characteristic of BDD is the concept of expressing tests in plain English sentences. User stories should be accompanied with clear descriptive acceptance criteria, which describe expected behavior in the system under test.

In support of this concept, ...

Get Groovy for Domain-specific Languages - Second Edition 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.