如何使用 Eclipse 中的 Ant 运行 Junit 插件测试 [英] How to run a Junit Plugin Test using Ant from eclipse

查看:34
本文介绍了如何使用 Eclipse 中的 Ant 运行 Junit 插件测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何使用 Eclipse 中的 ant 运行 junit 插件测试,也可以从命令提示符运行?我使用的是 Junit4.4.

How can we run a junit plugin test using ant from eclipse, also from command prompt? I'm using Junit4.4.

推荐答案

org.eclipse.test 插件提供了一个 library.xml 文件,其中包含用于运行的 ant 任务插件在 UI(ui-test 目标)和无头(core-test 目标)模式下进行测试.调用以下任务的示例,您需要提供一些属性以适应您自己的环境并检查 org.eclipse.test 插件版本:

The org.eclipse.test plugin provides a library.xml file that contains ant tasks for running plugin tests both in UI (ui-test target) and headless (core-test target) modes. Example of invoking the task below, you'll need to provide a few properties to suite your own environment and check the org.eclipse.test plugin version:

<property name="library-file"
    value="${eclipse-home}/plugins/org.eclipse.test_3.2.0/library.xml" />

...

    <ant target="ui-test" antfile="${library-file}"
        dir="${eclipse-home}">
        <property name="data-dir" value="${workspace}" />
        <property name="plugin-name" value="${plugin-name}" />
        <property name="classname"
            value="com.example.MyTestSuite" />
        <property name="junit-report-output" value="${results.dir}"/>
    </ant>

这篇关于如何使用 Eclipse 中的 Ant 运行 Junit 插件测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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