Spock without maven or gradle

I have a standard Java project that uses ant to build. I would like to add spock testing to this project without breaking the current process. What is the minimum set of changes that would allow me to start integrating spock testing into this project.

Information on integrating spock into legacy projects is not available using ant.

+7
source share
2 answers

If you have the jUnit and Spock test suite in the test suite (for example, we do), you can use the groovyc co-compilation function, something like this:

  <groovyc srcdir="${testSrcDir}" destdir="${testTarget}" classpathref="testCompileClasspath"> <javac deprecation="on" debug="on"/> </groovyc> 

This will automatically compile Java and Groovy tests. From now on, you can run tests as before using the junit task.

+7
source

You just need to compile your Spock tests using the groovyc Ant task (using Spock on the class path) and run them using the junit Ant task (again using Spock on the class path). See the spock-example zip that comes with the design Ant. (You may have to come across a version of maven-ant -tasks to make this work).

+5
source

All Articles