没有 maven 或 gradle 的 Spock [英] Spock without maven or gradle

查看:40
本文介绍了没有 maven 或 gradle 的 Spock的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 ant 进行构建的标准 Java 项目.我想在不中断当前流程的情况下向这个项目添加 spock 测试.允许我开始将 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.

关于使用 ant 将 spock 集成到遗留项目中的可用信息并不多.

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

推荐答案

如果您的测试包中混合使用了 jUnit 和 Spock 测试(就像我们所做的那样),您可以使用 groovyc<的联合编译功能/code>,类似这样:

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> 

这将自动编译 Java 和 Groovy 测试.从现在开始,您可以像以前一样使用 junit 任务运行测试.

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.

这篇关于没有 maven 或 gradle 的 Spock的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆