Skip to content
Hello World of how to use Spock in unit tests, using Gradle.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Topera's Hello World #004

Spock configured with Gradle

This hello world shows a unit test executed in Spock.

  • Test classes are groovy files in src/test/groovy folder.
  • Production code are java files in src/main/java folder.

How to download this source code

  • Install Gradle
  • Use the Clone or download button above the get the url of this repository
  • In IntelliJ IDEA: File → New → Project From Version Control → Git → put the url of this repository

How to test

  • $ cd gradle-spock
  • $ gradle test
  • The test will fail on purpose. Open the HTML report generated in ./build/reports/tests/test/index.html

Tech Stack

  • Intellij IDEA 2016.1.4
  • Gradle 4.0.0
  • Java 8
  • Spock 1.1

Folder Structure


To take a look in other projects, please see

You can’t perform that action at this time.