【问题标题】:Use one class more than once in TestNG在 TestNG 中多次使用一个类
【发布时间】:2013-05-17 13:05:11
【问题描述】:

在我使用 TestNG 和 Selenium 运行的测试中有一个结构示例:

<test>
      <classes>

          <class name="com.pou.MyTest">
                  <methods>
             // params here
             <include name="myMethodOne" />
          </methods>
          </class>

          <class name="com.pou.MyTest">
                  <methods>
             // params here
             <include name="myMethodTwo" />
          </methods>
          </class> 

      </classes>
</test>

运行此套件后,我收到一个错误:

org.testng.TestNGException:在[DynamicGraph

中找不到空闲节点

听说是同一个方法一次调用两次造成的

现在的问题是:我可以在一次测试中使用相同的课程两次吗?

我还要补充一点,由于某些原因,我需要将它放在一个测试中,因此将它分成两个不同的测试不是我需要的方法。

【问题讨论】:

    标签: java testing selenium testng


    【解决方案1】:

    考虑改用@DataProvider,类在每个测试标签中只能出现一次。

    【讨论】:

    • 这里不能使用DataProvider。如果他正在执行的方法不同,他为什么要使用DataProvider??
    猜你喜欢
    • 2011-04-02
    • 2017-09-14
    • 1970-01-01
    • 1970-01-01
    • 2019-06-18
    • 2017-03-28
    • 1970-01-01
    • 2016-02-20
    • 2020-09-25
    相关资源
    最近更新 更多