The Enterprise-ready testing and specification framework.
The Enterprise-ready testing and specification framework.
:spock-release-version: 2.4 :spock-release-date: 2025-12-11 :spock-snapshot-version: 2.4
https://github.com/spockframework/spock/blob/master/LICENSE[image:https://img.shields.io/badge/License-Apache%202.0-blue.svg[License]] https://search.maven.org/search?q=g:org.spockframework[image:https://img.shields.io/maven-central/v/org.spockframework/spock-core.svg?label=Maven%20Central[Maven Central]] https://github.com/spockframework/spock/actions/workflows/release.yaml[image:https://img.shields.io/github/actions/workflow/status/spockframework/spock/release.yaml?branch=master[GitHub Workflow Status (branch)]] https://jitpack.io/#org.spockframework/spock[image:https://jitpack.io/v/org.spockframework/spock.svg[Jitpack]] https://codecov.io/gh/spockframework/spock[image:https://codecov.io/gh/spockframework/spock/branch/master/graph/badge.svg[Codecov]] https://gitter.im/spockframework/spock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge[image:https://badges.gitter.im/spockframework/spock.svg[Gitter]] https://community.develocity.cloud/scans?search.rootProjectNames=spock[image:https://img.shields.io/badge/Revved%20up%20by-Develocity-06A0CE?logo=Gradle&labelColor=02303A[Revved up by Develocity]]
image::docs/images/spock-main-logo.png[width=100px,float=right]
== Spock Framework
Spock is a BDD-style developer testing and specification framework for Java and https://groovy-lang.org/[Groovy] applications. To learn more about Spock, visit https://spockframework.org[https://spockframework.org]. To run a sample spec in your browser use the https://groovyconsole.dev/[Groovy Web Console].
=== Latest Versions
NOTE: Spock 2.x is based on the JUnit Platform and requires Java 8+/groovy-2.5+ (Groovy 3.0 or newer is recommended, especially in projects using Java 12+).
Releases are available from https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.spockframework%22[Maven Central]. Development snapshots are available from https://central.sonatype.com/repository/maven-snapshots/org/spockframework/spock-core/maven-metadata.xml[Sonatype Snapshot].
==== Snapshot Releases
Snapshots can be used by adding the Sonatype Snapshot repository:
repositories { // ... maven { url 'https://central.sonatype.com/repository/maven-snapshots/' } }
dependencies { testImplementation 'org.spockframework:spock-core:{spock-snapshot-version}-groovy-4.0-SNAPSHOT'
==== Ad-Hoc Intermediate Releases
For intermediate stable builds we recommend to use https://jitpack.io/#org.spockframework/spock[JitPack] (go here for instructions):
. Add https://jitpack.io[https://jitpack.io] as a repository
. Use org.spockframework.spock as groupId and the normal
artifact-id
repositories { // ... maven { url 'https://jitpack.io' } }
dependencies { testImplementation 'org.spockframework.spock:spock-core:spock-{spock-release-version}' testImplementation 'org.spockframework.spock:spock-spring:spock-{spock-release-version}'
[start=3]
. For intermediate releases you can also use the commit-hash as version,
e.g. compile com.github.spockframework.spock:spock-core:d91bf785a1
=== Modules
=== Building
==== Prerequisites
Spock needs both a JDK 11 and JDK 17+ installed.
JDK locations must be made known to toolchains via JDK<version>=<PATH> environment
variable if they are not in standard places recognized by Gradle, e.g. JDK11=/path/to/jdk11.
==== Supported versions
Spock is supported for Java version 8+.
Spock is supported for Groovy versions 2.5, 3.0, 4.0, and 5.0.
The tests are testing Spock with the specific versions (variants) of Groovy and Java. Default Groovy version is 2.5.
The Groovy 3.0 and 4.0 variant should pass on all supported JDK versions, Groovy 2.5 does not work with Java 17+: Groovy 5.0 and newer does not work with Java <11:
.... ./gradlew build ....
To build a specific variant of Spock, use the variant name as a parameter
.... ./gradlew build -Dvariant=4.0 ....
To test against a specific Java version, use the java version name as a parameter, the path to the Java version must be set via an environment variable JDK<version>=<PATH>.
Of course, this can be combined with the variant selection from above.
.... ./gradlew build -DjavaVersion=17 ....
(In cmd.exe: gradlew build). All build dependencies, including the
https://www.gradle.org[build tool] itself, will be downloaded
automatically (unless already present).
=== Contributing
Contributions are welcome! Please see the https://github.com/spockframework/spock/blob/master/CONTRIBUTING.adoc[contributing page] for detailed instructions.
=== Support
If you have any comments or questions, please direct them to the https://github.com/spockframework/spock/discussions[user forum]. All feedback is appreciated!
=== Java 9 Module Names
All published jars (beginning with Spock 1.2) will contain
Automatic-Module-Name manifest attribute. This allows for Spock to be
used in a Java 9+ Module Path.
org.spockframework.coreorg.spockframework.springorg.spockframework.tapestryorg.spockframework.guiceorg.spockframework.unitilsSo module authors can use well known module names for the spock modules, e.g. something like this:
.... open module foo.bar { requires org.spockframework.core; requires org.spockframework.spring; } ....
=== Logo
The Spock Logo, created by Ayşe Altınsoy (@AltinsoyAyse), is managed in the https://github.com/spockframework/spock-logo[spock-logo repository].
=== Links
Live Long And Prosper!
The Spock Framework Team
No open issues yet, or sync has not completed.