【问题标题】:Running TestNG testng.xml tests from Eclipse从 Eclipse 运行 TestNG testng.xml 测试
【发布时间】:2017-02-05 19:59:07
【问题描述】:

我有一些包裹

com.company.testing.module1
com.company.testing.module2
com.company.testing.module3

我也有一些类在

中有 TestNG 注释
com.company.testing.tests

现在我将 testng.xml 放入

com.company.testing

XML 文件看起来像

<?xml version="1.0" encoding="UTF-8"?>
<suite name="Foo">
    <test name="Bar">
        <package>
            <package name="com.company.testing.tests" />
        </package>
    </test>
</suite>

如何从 Eclipse 运行该套件?我应该做什么运行配置?

【问题讨论】:

    标签: eclipse classpath testng


    【解决方案1】:

    安装TestNG plug-in,完成后,您只需右键单击您的 XML 文件并“运行为/调试为... TestNG。

    【讨论】:

    • 我没有意识到 XML 可以直接运行。我运行它并得到Total tests run: 0, Failures: 0, Skips: 0 结果。似乎没有执行任何测试。我怀疑有一些类路径配置需要完成。我对么?附言我很惊讶TestNG的作者正在回答我!
    • 我遇到了同样的问题,运行了 0 个测试。我正在尝试从 Windows 7 中的 DOS 命令提示符运行相同的设置。有人弄清楚了吗?
    • 在你的 testng.xml 中使用它并根据你的测试替换值 ttp://testng.org/testng-1.0.dtd" rel="nofollow" target="_blank">testng.org/testng-1.0.dtd" >
    • 为我工作就像一个魅力!但由于我将其作为基础 maven 测试项目,因此我刚刚添加了适当的依赖项。
    【解决方案2】:

    您需要 testng 插件。然后它只是运行 testng 任务的问题。有关详细信息,请参阅docs

    【讨论】:

      【解决方案3】:

      通过testNG.xml 运行您的测试 转到类文件右键单击并选择运行为 >>run configuratins。 选择 Suite 并浏览您的 testNG.xml(eclipse 中的默认值 - testng-customsuite.xml)并运行。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-12-30
        • 1970-01-01
        • 2018-03-27
        • 2017-04-23
        • 1970-01-01
        • 2010-12-12
        • 1970-01-01
        相关资源
        最近更新 更多