Spock: A Highly Logical Way To Test

Spock is a fabulous new testing framework for the JVM. Spock leverages all the DSL power of the Groovy language to make testing a breeze. Spock tests are concise and readable, with excellent support for error reporting and for mock object creation. Spock removes much of the pain from test driven development!

Spock is a testing DSL (Domain Specific Language) that transforms the Groovy programming language into a language specifically targeting testing. Spock can be used to test Java, Groovy, or any JVM language.

In Spock, classes are test specifications; methods of those classes are used to describe expected features of the system under specification. Each feature method is broken up into blocks that specify a stimulus (such as invoking a method) and a response (the behavior or state from that method invocation). Spock keeps you honest about what kind of code can appear in each block, and the end result is a highly readable, highly maintainable test.

Spock also has first class support for mock-object testing, and the Spock DSL uses an elegant and obvious syntax to specify how the mock objects interact with the system under specification. Rolled together, Spock is a formidable tool … and makes using any other testing framework a highly illogical choice.


About Howard Lewis Ship

Howard Lewis Ship is the original creator of the Apache Tapestry project, and is a noted expert on Java framework design and developer productivity. He has over twenty years of full-time software development under his belt, with over fifteen years of Java. He cut his teeth writing customer support software for Stratus Computer, but eventually traded PL/1 for Objective-C and NeXTSTEP before settling into Java.

Howard has been developing financial and e-commerce applications in 100% Clojure since 2012.

Howard currently works for Wal-Mart's Global E-Commerce division. He lives in Portland, Oregon with his wife Suzanne, and his children, Jacob and Olivia.

More About Howard »