Getting started with spock – Installation or Setup

Spock framework information can be found at the Spock website.

There are basically three ways to use Spock in Groovy

  1. as a dependency using the Grape dependency manager :

Add the following to your groovy script.

@Grab(group='org.spockframework', module='spock-core', version='1.1-groovy-2.4.1')

or in shorthand

@Grab('org.spockframework:spock-core:1.1-groovy-2.4.1')
  1. as a maven dependency using the Gradle build tool (build.gradle)

Add the following dependency to the build.gradle file under dependencies

...
dependencies {
    // mandatory dependencies for using Spock
    compile "org.codehaus.groovy:groovy-all:2.4.1"
    testCompile "org.spockframework:spock-core:1.0-groovy-2.4"
}
...
  1. Adding the spock-core library to your lib path

Adding the spock-core-1.0-groovy-2.4.jar to a location in your classpath where groovy can find it.

and last but not least you need to import the library so that it can be used in your groovy script

import spock.lang.*

After you installed spock then try one of the hello world examples.

if you want to reproduce, please indicate the source:
Getting started with spock – Installation or Setup - CodeDay