2. ABOUT THE SPEAKER
Java developer since the beginning
True believer in open source
Groovy committer since 2007
Project lead of the Griffon framework
Currently working for
3. WHAT IS SPOCK?
Where, Who, How?
■ http://spockframework.org
■ Peter Niederwiser
@pniederw
■ Groovy based Testing
Language
■ Byte code manipulation at
compile time
■ Inspired by
JUnit, Rspec, jMock, Moc
kito, Groovy, Scala and
Why?
■ Expressive testing
language
■ Easy to learn
■ Usable from unit to end-toend level
■ Leverages Groovy
language features
■ Runs with JUnit:
compatible with IDEs, build
tools & CI
■ Extensible for specialized
testing scenarios
3
7. FEATURE LIST (1)
Blocks
■ given:
■ when:
■ then:
■ expect:
■ where:
■ and:
■ setup:
■ cleanup:
preconditions, data fixtures, etc.
actions that trigger some outcome
makes assertions about outcome
short alternative to when & then
applies varied inputs
sub-divides other blocks
alias for given
post-conditions, housekeeping, etc.
7
8. FEATURE LIST (2)
Lifecycle
■ setup
■ cleanup
■ setupSpec
■ cleanupSpec
Data Driven
■ List based variables
■ Table based variables
■ @Unroll
■ @Shared
8
12. BUT WAIT, THERE’S MORE!
■ http://docs.spockframework.org/en/latest
■ Spock is extensible via plugins
■ Functional web testing with GEB
■ Plugins exist for Grails and Griffon
■ Next release will be 1.0.0
12