This is a "Hello World"-style Spock test suite.
This is a minimal runnable example of a Spock test suite and the prerequisite environment configuration. There is quite
a bit to configure from dependency management, Groovy support, and optionally test logging configuration. Spock also has
official examples that you should check out in the GitHub repository spockframework/spock-example
.
Follow these instructions to build and run the test suite.
- Pre-requisite: Java 21
- Run the test suite
-
./gradlew test
- It should look like the following.
-
$ ./gradlew test > Task :test BasicSpecification > addition PASSED BasicSpecification > add via Adder PASSED
- Because Gradle has a task caching feature, it will actually consider your test task to be "up-to-date" if you run
the
test
task again and the tests won't be run. To force Gradle to run the test suite again, use thecleanTest
task.
-