Test method execution when using "dependsOnGroups" in TestNG

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Test method execution when using "dependsOnGroups" in TestNG

jithinmathew
Hi All,

I want to map test class methods effectively. Here is my Test Class Structure,


Class A:

public class Group1 {

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

public void G1test1(){

    System.out.println("G1test1");

   

}

@Test(priority=2,groups = "A")

public void G1test2(){

    System.out.println("G1test2");


}

}


Class B:


public class Group2 {

@Test(priority=1,groups = "B",dependsOnGroups="A")

public void G2test1(){

    System.out.println("G2test1");

}

@Test(priority=2,dependsOnGroups="A")

public void G2test2(){

System.out.println("G2test2");

}

}


Class C:


public class Group3 {

@Test(priority=1,groups = "B",dependsOnGroups="A")

public void G3test1(){

    System.out.println("G3test1");

}

@Test(priority=2,dependsOnGroups="A")

public void G3test2(){

System.out.println("G3test2");

}

}


Class D:


public class Group4 {

@Test(priority=1,groups = "C",dependsOnGroups="B")

public void G4test1(){

    System.out.println("G4test1");

}

@Test(priority=2,dependsOnGroups="B")

public void G4test2(){

System.out.println("G4test2");

}

}


OutPut:


G1test1

G1test2

G2test1

G3test1

G4test1

G2test2

G3test2

G4test2


Desired Output:


G1test1

G1test2

G2test1

G2test2

G3test1

G3test2

G4test1

G4test2



My testng.xml file is like this,

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">

<suite name="Suite">

  <test name="Test1" preserve-order="true">

    <classes>

      <class name="grid.Group1"/>

      <class name="grid.Group2"/>

      <class name="grid.Group3"/>

      <class name="grid.Group4"/>

    </classes>

  </test> <!-- Test -->

</suite> <!-- Suite -->



How can i achieve this?

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Loading...