Spock without maven or gradle

霸气de小男生 提交于 2019-12-01 04:26:24

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.

You just need to compile your Spock tests with the groovyc Ant task (with Spock on the class path), and run them with the junit Ant task (again with Spock on the class path). Have a look at the spock-example zip, which comes with an Ant build. (You might have to bump the version of maven-ant-tasks to make that build work).

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!