【问题标题】:How to add multiple files in xml file in TestNG如何在TestNG的xml文件中添加多个文件
【发布时间】:2020-10-13 08:39:56
【问题描述】:

创建 xml 文件以运行所有 java 文件时,它没有显示所有 java 文件,

如果手动添加文件名,那么它也不会运行所有的 java 文件

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="Suite">
  <test thread-count="5" name="Test">
    <classes>
      <class name="Entry.StatusHistory"/>
      <class name="Entry.Dashboard"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

它只运行 Entry.StatusHistory 这个文件。 如何解决这个问题?

【问题讨论】:

    标签: java selenium testng


    【解决方案1】:

    请确保您在 Dashboard 类中使用了 testNG 注释。当你的类中没有测试用例时会发生这种情况 (@test)。因此,testNG.xml 不会运行该类。

    【讨论】:

    • 在两个文件中都使用了(@Test),然后它也没有运行。因为我将 (@Test) 放在两个文件中的不同位置。好的,谢谢你弄错了。
    • 感谢您将此标记为答案,非常感谢。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-06
    • 1970-01-01
    相关资源
    最近更新 更多