You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
Go to file
Leonard Brünings c8101569d9
Update to M4 switch to groovy-3 variant, Update gradle to 6.7.1
4 years ago
.mvn/wrapper Update to 2.0 and remove ANT example 5 years ago
gradle Update to M4 switch to groovy-3 variant, Update gradle to 6.7.1 4 years ago
src/test Upgrade Maven project to Spock 2.0-M3, ... (#35) 5 years ago
.gitignore Update Dependencies 8 years ago
.travis.yml Fix builds by switching to openjdk8 6 years ago
LICENSE initial commit 13 years ago
NOTICE initial commit 13 years ago
README.adoc Upgrade Maven project to Spock 2.0-M3, ... (#35) 5 years ago
build.gradle Update to M4 switch to groovy-3 variant, Update gradle to 6.7.1 4 years ago
gradlew Update to 2.0 and remove ANT example 5 years ago
gradlew.bat Update to 2.0 and remove ANT example 5 years ago
mvnw Add TravisCi integration and update build tools (#21) 7 years ago
mvnw.cmd Add TravisCi integration and update build tools (#21) 7 years ago
pom.xml Update to M4 switch to groovy-3 variant, Update gradle to 6.7.1 4 years ago
settings.gradle added settings.gradle 13 years ago

README.adoc

[.float-group]
--
image::https://img.shields.io/badge/License-Apache%202.0-blue.svg[link=https://github.com/spockframework/spock/blob/master/LICENSE,float=left]
image::https://img.shields.io/travis/spockframework/spock-example/master.svg?label=Build[link=https://travis-ci.org/spockframework/spock-example,float=left]
image::https://badges.gitter.im/spockframework/spock.svg[link=https://gitter.im/spockframework/spock?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge,float=left]
--

== Spock Framework Example Project


The purpose of this project is to help you get started with Spock. The project includes several example specifications and build scripts for Ant, Gradle, and Maven. It also makes it easy to create an Eclipse or IDEA project, allowing you to run the example specs from within your IDE.

All three builds (Ant, Gradle, Maven) will automatically download all required dependencies, compile the project, and finally run the example specs. The Gradle build goes one step further by bootstrapping itself, alleviating the need to have a build tool preinstalled.

=== Prerequisites

- JDK 8 or higher
- Maven use `mvnw` wrapper
- Gradle use `gradlew` wrapper

NOTE: This example shows the usage of Spock 2.0, which uses the JUnit Platform. If you want to see how to get Spock 1.x with JUnit 4 up and running see the https://github.com/spockframework/spock-example/tree/spock-1.x[Spock-1.x] Branch.

=== Building with Gradle
Type:

    ./gradlew clean test

Downloaded files (including the Gradle distribution itself) will be stored in the Gradle user home directory (typically *user_home*`/.gradle`).

=== Building with Maven
Type:

    ./mvnw clean test

Downloaded files will be stored in the local Maven repository (typically *user_home*`/.m2/repository`).

=== Creating an Eclipse project
Type:

    ./gradlew cleanEclipse eclipse

Make sure you have a recent version of the Groovy Eclipse plugin installed. After importing the generated project into a workspace, go to Preferences->Java->Build Path->Classpath Variables and add a variable named `GRADLE_CACHE` with value *user_home*`/.gradle/cache`. (If you have an environment variable `GRADLE_USER_HOME` set, the correct value is *GRADLE_USER_HOME*`/cache`.) You should now be able to build the project, and to run the specs like you would run a JUnit test. See http://wiki.spockframework.org/GettingStarted#Eclipse for more information on how to get started with Spock and Eclipse.

=== Creating an IDEA project
Just open the project directory with Intelli IDEA and it should auto-detect the project settings.

Alternatively Type:

    ./gradlew cleanIdea idea

Open the generated project in IDEA. You should now be able to build the project, and to run the specs like you would run a JUnit test.

NOTE: you might also want to install https://github.com/mycila/gmavenplus-intellij-plugin so that `src/test/groovy` is correctly recognized as a test classes root.

=== Getting hold of the Jars used in this project
Type:

    ./gradlew collectJars

The Jars will be copied to `build/output/lib`. The comments in `build.gradle` explain what they are needed for.

=== Further Resources


* http://spockframework.org[Spock homepage]
* https://meetspock.appspot.com[Spock web console]
* http://docs.spockframework.org/[Main documentation]
* http://forum.spockframework.org[User discussion group]
* http://dev.forum.spockframework.org[Dev discussion group]
* http://issues.spockframework.org[Issue tracker]
* http://builds.spockframework.org[Build server]
* http://blog.spockframework.org[Spock blog]
* https://twitter.com/spockframework[Spock on Twitter]
* http://ant.apache.org[Ant homepage]
* http://www.gradle.org[Gradle homepage]
* http://groovy-lang.org/[Groovy homepage]
* http://maven.apache.org[Maven homepage]

If you have any comments or questions, please direct them to the Spock discussion group. We appreciate all feedback!

Happy spec'ing!

The Spock Framework Team