2. Meta & Intro
State Based Testing
Data Driven Testing
Interaction Based Testing
Spock Extensions
More Cool Stuff
What we’ll talk about
3. The creator of Spock
Groovy & Gradle committer
Works for Gradleware
@pniederw
3
Peter Niederwieser
4. A developer testing framework...
for Groovy and Java applications...
based on Groovy...
fully compatible with JUnit...
but going beyond!
Spock is...
18. How objects communicate
Mocking frameworks simplify the job
Spock has its own mocking framework
Google it: “Mocks aren't Stubs”
Interaction Based Testing
23. Group conditions/interactions w/ same target
Better mocking failure messages
New in 0.7 (1)
with(person) {
name == “Fred”
age == 30
sex == “male”
}
with(service) {
1 * start()
1 * stop()
}
24. Stubs
Spies
Groovy mocks
Declare interactions upfront
More at:
http://docs.spockframework.org/en/latest/new_and_noteworthy.html
New in 0.7 (2)
def person = Stub(Person)
def person = Spy(Person, constructorArgs: ["Fred", 30])
def person = GroovyMock(person) // GroovyStub, GroovySpy
def person = Mock(Person) {
1 * sleep()
sing() >> “tra-la-la”
}
25. Meta & Intro
State Based Testing
Data Driven Testing
Interaction Based Testing
Spock Extensions
More Cool Stuff
What we’ll talk about