Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spock without maven or gradle

Tags:

groovy

ant

spock

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

There is not much available information on spock integration into legacy projects using ant.

like image 476
George Smith Avatar asked Sep 06 '11 05:09

George Smith


1 Answers

If you have a mix of jUnit and Spock tests in your test package (like we do), you can use the joint compilation feature of groovyc, something like this:

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

This will automagically compile both the Java and Groovy tests together. From this point on, you can run the tests as before using the junit task.

like image 57
Jeff Olson Avatar answered Oct 02 '22 18:10

Jeff Olson