1.3. Spock: the groovier testing framework

When I first came upon Spock, I thought that it would be the JUnit alternative to the Groovy programming language. After all, once a programming language reaches a critical mass, somebody ports the standard testing model, known as xUnit (https://en.wikipedia.org/wiki/XUnit), to the respective runtime environment. xUnit frameworks already exist for all popular programming languages.

But Spock is not the xUnit of Groovy! It resembles higher-level testing frameworks, such as RSpec and Cucumber (https://github.com/cucumber/cucumber-jvm), that follow the concepts of BDD, instead of the basic setup-stimulate-assert style of xUnit. BDD attempts (among other things) to create a one-to-one mapping between business ...

Get Java Testing with Spock now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.