IntelliJ使用单元测试生成ant构建?

时间:2011-01-15 19:34:13

标签: hudson intellij-idea

如何使用IntelliJ生成的ant构建并合并项目的单元测试?我想将Hudson纳入我的开发过程。

1 个答案:

答案 0 :(得分:2)

编辑build.xml以包含<junit><junitreport>任务。

<target name="junit-test" description="run all junit tests" depends="compile">
    <!-- Debug output
            <property name="test.class.path" refid="test.class.path"/>
            <echo message="${test.class.path}"/>
    -->
    <junit printsummary="yes" haltonfailure="${haltonfailure}">
        <classpath refid="test.class.path"/>
        <formatter type="xml"/>
        <batchtest fork="yes" todir="${junit.out}">
            <fileset dir="${test.src}">
                <include name="**/*Test.java"/>
            </fileset>
        </batchtest>
    </junit>
    <junitreport todir="${junit.out}">
        <fileset dir="${junit.out}">
            <include name="TEST-*.xml"/>
        </fileset>
        <report todir="${junit.out}" format="frames"/>
    </junitreport>
</target>