Workshop to learn about Spock Framework
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This workshop is aimed to all those who want to learn and understand the basics of Spock Framework using Groovy.

If you want to follow this workshop by your own, we strongly recommend you to check Spock basics before start coding.

How to start

You can find three different exercises in /src/test/ in the master branch:

Each of the files is a Spock test, and you will find there some comments that explain what to do.

There already is working code in /src/main/ that you should not change. It works as it is, and you should only change the Spec files, creating everything you need in order to complete all the TODO tasks.

Each TODO task should be solved using only one feature method, but feel free to do it your way.

Run the tests with Gradle

./gradlew test

Run the tests with IntelliJ IDEA

First of all, import the project in IntelliJ:

  • File > New > Project from Existing Sources...
  • Select the build.gradle file.
  • Select Use default gradle wrapper in the import process and an existing java version.

Finally, you can select a specific test file or a package and Secondary click > Run [file|Tests in package].


You will find our solutions proposal in the Solutions branch.

We tried to solve the tasks using different approaches in order to show different Spock features.

If you don't understand something in the solved exercises, we recommend you to search for it in the Spock Framework Reference Documentation. You will find there everything we used.