Ant-具有不同系统属性的JUnit批测试

时间:2018-10-21 14:46:41

标签: junit ant

我目前正在使用Ant作为构建系统的项目中,我必须在其中添加具有不同批处理测试的JUnit任务。
每个批次测试的系统属性都需要一个不同的值。我看到batchtest标记不支持嵌套的sysproperties。

以下是我需要的示例:

<junit dir="$myDir" printsummary="yes" haltonerror="yes" haltonfailure="yes" fork="yes" forkmode="perBatch" tempdir="tmpDir" maxmemory="4096m">
    <sysproperty key="CommonProperty1" value="value1" />
    <sysproperty key="CommonProperty2" value="value2" />

    <classpath>
        <path path="myClasspath" />
    </classpath>
    <formatter type="brief" usefile="false" />
    <formatter type="xml" />

    <batchtest todir="toDir">
        <sysproperty key="CustomProperty" value="Test1" />
        <fileset dir="myTestDir">
            <include name="Test1.java" />
        </fileset>
    </batchtest>
    <batchtest todir="toDir">
        <sysproperty key="CustomProperty" value="Test2" />
        <fileset dir="myTestDir">
            <include name="Test2.java" />
        </fileset>
    </batchtest>
</junit>

sysproperty标记放在batchtest里面是行不通的。

有人知道应对这种情况的最佳方法是什么吗?
谢谢

0 个答案:

没有答案