Java Reference
In-Depth Information
cussions in this section), and you can immediately be productive. Spock provides both tests
and a solid mocking capability in an easy-to-use package.
According to the developer of the framework, [ 15 ] the name Spock is a blend of “specific-
ation” and “mock.” That may even be true. It seems more likely, however, that somebody
just liked the name Spock and the rest is clever rationalization. [ 16 ] The result, inevitably,
is that any discussion of the framework results in a series of Star Trek -related puns. My
original plan was to avoid them, but it's practically impossible. [ 17 ]
15 Peter Niederweiser, who is active and helpful on the Spock email list.
16 Of which I totally approve.
17 For example, Spock is a logical framework for enterprise testing. Test well, and prosper. I have been, and always
shall be, your friendly testing framework.
6.4.1. The Search for Spock
The main site for Spock is http://spockframework.org, which actually redirects to a Google
code project at https://code.google.com/p/spock/. There you'll find wiki pages with lots of
good information. Like most cool projects these days, the source code is hosted at GitHub
at https://github.com/spockframework/spock. Youcanclonetherepositoryanddoamanual
build, or you can install the distribution from the standard Maven repository.
Spock versions are tied to Groovy versions. The latest release version of Spock is
0.7-groovy-2.0. Don't let the low version number deter you. [ 18 ] The Spock API is simple
and easy to use and understand, and its adoption has been very rapid. [ 19 ]
18 Version 1.0 is due out by the time this topic appears in print.
19 The Spock plugin will be included in Grails by default starting in version 2.3.
The Gradle file in the next listing shows the appropriate dependencies to build this
chapter's source code.
Listing 6.25. Building and testing with Spock using Gradle
apply plugin: "groovy"
repositories {
 
 
 
 
 
Search WWH ::




Custom Search