- In order to add the Spock tests to our application, we will need to make a few changes to our build.gradle file first. As Spock tests are written in Groovy, the first thing to do is add a groovy plugin to our build.gradle file, as follows:
apply plugin: 'java' apply plugin: 'eclipse' apply plugin: 'groovy' apply plugin: 'spring-boot'
- We will also need to add the necessary Spock framework dependencies to the build.gradle dependencies block:
dependencies { ... testCompile('org.spockframework:spock-core:1.1-groovy-2.4-rc-2') testCompile('org.spockframework:spock-spring:1.1-groovy-2.4-rc-2') ... }
- As the tests will be in Groovy, we will need to create a new source directory for the files. Let's create the src/test/groovy/com/example/bookpub ...