简体   繁体   中英

Use one class more than once in TestNG

There is and example of structure in my test running using TestNG and 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>

After running this suite I recive an error:

org.testng.TestNGException: No free nodes found in:[DynamicGraph

I was told that it is caused by calling the same method twice in one

Now the question is: Can I use the same class twice in one test?

I'll also add that for some reasons I need to have it in one test, so spliting it to two different tests is not the approach I need.

考虑使用@DataProvider代替,类只能在每个测试标记中出现一次。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM