在我使用 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: No free nodes found in:[DynamicGraph
我被告知是一次调用两次相同的方法造成的
现在的问题是:我可以在一次测试中两次使用同一个类吗?
我还要补充一点,由于某些原因我需要在一次测试中使用它,因此将它分成两个不同的测试并不是我需要的方法。
最佳答案
考虑使用 @DataProvider
代替,类在每个测试标记中只能出现一次。
关于java - 在 TestNG 中多次使用一个类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16609831/