Question

I am using two methods of same class in testng, but it is not allowing me so... it is giving exception

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

my testng file is

<test name="User Data" preserve-order="true">
<classes>
    <class name="LoginTest">
        <methods>
            <include name="Login" />         
        </methods>
    </class>
<class name="xtr.chaut.test.PatientProfileTest">
      <methods>
            <include name="openPatientProfile"></include>
            <include name="checkUserData"></include>
       </methods>
</class>
  <class name="xtr.chaut.test.Login">
      <methods>
          <include name="logout"></include>
      </methods>
  </class>
</classes> 

here login and logout methods are from same class

please give me any solution for this

Thanks in advance

Was it helpful?

Solution

It appears that each class can only be declared once in the list, even if different methods are included on each declaration, otherwise you will see this error message :( Using latest TestNG 6.8.8. I was able to get this to work with @Test(priority=#) with the specific priority on each test method. See http://testng.org/doc/documentation-main.html#annotations.

My use case: crud tests for entities. Each Entity has its own test class with 4 methods (so I can test only a single entity CRUD in isolation), but I also want to run the overall suite (will fail due to integrity constraints and different generated ID keys unless they are run in exactly the right order).

Same question asked at Getting org.testng.TestNGException: No free nodes found in:[DynamicGraph Exception.

OTHER TIPS

I fixed it by adding parallel="true", below is the code

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Sanity Testing" parallel="true">
  <test name="VerifyTitles">
    <classes>
      <class name="WebDriver.VerifyTitles"/>
      <class name="WebDriver.VerifyTitles2"/>
    </classes>
  </test> <!-- Test -->
</suite> <!-- Suite -->

I,ve got the same error, when I set number under zero for priority:

@Test(groups = "setup", priority = -1)

when I set for priority natural number, eg.

@Test(groups = "setup", priority = 1)

everything works fine.

Remove negative priority values for test cases. It worked for me.

I also got this error by defining a row of dependencies, tagged with a priority number. But then forgot a priority tag for one of the methods which are dependent on other.

E.g in the test class:

@Test
public void test1() throws Exception{ ...

@Test( priority=2 )
public void test2() throws Exception{ ...

@Test( priority=2, dependsOnMethods={"test2"})
public void test3() throws Exception{ ...

@Test( dependsOnMethods={"test3"})
public void test4() throws Exception{ ...

The test4 will cause the exception, as it is dependent on test3, but has no priority.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top