Because Spock tests are in Groovy, the support of Spock in your IDE will be as good as the existing support for Groovy. As explained previously, you don’t need to install Groovy support in your IDE in order to run Spock tests. It’s a nice-to-have feature because of its syntax highlighting and autocomplete facilities. The only thing specific to Spock is the test output result that should be set up to use a fixed-width font so that failure messages show up properly. For more information, see http://www.groovy-lang.org/ides.html. I use Eclipse, but Groovy is supported on most major environments.
To gain Groovy support in Eclipse, install either the vanilla Groovy plugin or the full-featured Groovy/Grails plugin. Both can be found in the Eclipse marketplace, as shown in figure A.1. The Eclipse marketplace is accessible from the Help > Marketplace menu.
Once you do that, Groovy/Spock files will gain syntax highlighting and autocomplete support, as shown in figure A.2.
You can still use the Maven/Gradle commands to compile and run Spock tests.
There’s also a plugin dedicated to Spock, but upon installing it, I haven’t noticed any additional functionality (it also depends on the Groovy plugin, so it isn’t a true alternative). You can find it in the Eclipse marketplace, as shown in figure A.3.
Groovy support in IntelliJ IDEA is built in, so there’s no need to download an external plugin. You need only to enable it, as shown in figure A.4.
When the Groovy plugin is enabled, you gain syntax highlighting and autocomplete in Groovy files, as shown in figure A.5.
Again, as with Eclipse, you can still use the command-line Maven/Gradle commands to compile and run Spock tests. A dedicated Spock plugin for IntelliJ IDEA adds extra optional goodies, such as syntax highlighting for Spock labels (see figure A.6).
Again, this is something that’s nice to have, but is not otherwise essential for running Spock tests.
I haven’t tried NetBeans with Groovy, but it also supports Groovy. See https://netbeans.org/features/groovy/ for more details.
3.142.135.249