【问题标题】:junit system property with ant带有ant的junit系统属性
【发布时间】:2012-01-15 19:05:01
【问题描述】:

我的 ant 脚本有问题! 在我的 jUnit 测试中,我必须使用 System.getProperty 设置一个字符串。 当我使用 eclipse 和 vm 参数时一切正常,但使用 ant 脚本我无法传递系统属性...

这是我的蚂蚁 sn-p:

<junit fork="yes"  haltonfailure="false" showoutput="true">
    <sysproperty key="sdkpath" value="some path"/>          

    or
    <jvmarg value="-Dsdk_path=/some path/"/>

        <batchtest fork="false"  todir="${execution.home}">
            <fileset dir="${basedir}/src">
                <include name="**/**Test*.java" />
                <exclude name="**/MonkeyTest.java"/>
            </fileset>
        </batchtest>
        <formatter type="xml" usefile="true" />
        <classpath refid="test.classpath" />
        </junit>

【问题讨论】:

    标签: ant properties junit system


    【解决方案1】:

    改变

     <batchtest fork="false"  todir="${execution.home}">
    

     <batchtest todir="${execution.home}">
    

    【讨论】:

    • 这很奇怪。我做了那个改变,它在我的最后工作。您能否检查一下您是否能够在测试用例中读取其他系统属性(例如 java.version)的值。
    猜你喜欢
    • 2014-02-04
    • 2012-03-20
    • 1970-01-01
    • 1970-01-01
    • 2018-04-01
    • 1970-01-01
    • 2017-09-24
    • 1970-01-01
    • 2014-06-07
    相关资源
    最近更新 更多