jazoon'13 - andres almiray - spock: boldly go where no test has gone before

Post on 17-Jan-2015

209 Views

Category:

Technology

2 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

SPOCK:BOLDLY GO WHERE NO TEST HAS GONE BEFOREANDRES ALMIRAYCANOO ENGINEERING A.G.

@AALMIRAY

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

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, Mockito, Groovy, Scala and Vulcans

3

Why?

■ Expressive testing language

■ Easy to learn

■ Usable from unit to end-to-end level

■ Leverages Groovy language features

■ Runs with JUnit: compatible with IDEs, build tools & CI

■ Extensible for specialized testing scenarios

4

FIRST CUT

5

INTRODUCING A BUG

6

A WILD ERROR APPEARS!

FEATURE LIST (1)

Blocks

■ given: preconditions, data fixtures, etc.

■ when: actions that trigger some outcome

■ then: makes assertions about outcome

■ expect: short alternative to when & then

■ where: applies varied inputs

■ and: sub-divides other blocks

■ setup: alias for given

■ cleanup: post-conditions, housekeeping, etc.

7

FEATURE LIST (2)

Lifecycle

■ setup

■ cleanup

■ setupSpec

■ cleanupSpec

8

Data Driven■ List based variables■ Table based variables■ @Unroll■ @Shared

9

UNROLLING

UNROLLING AS SEEN BY AN IDE

10

11

INTERACTIONS (MOCKS)

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

THANK YOU!

@AALMIRAY

HTTP://PEOPLE.CANOO.COM/SHARE/

top related