Making a class dependent on other class using TestNG xml

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

Making a class dependent on other class using TestNG xml


We are facing an issue where while specifying dependency in TestNG xml the dependent test class runs but  the depended test don't run once the dependent tests execution is complete 

We are running test suites in parallel however there are certain tests which conflict with tests in other class and cause test failures. So we are looking a way to mark a test class - test1 dependent on another test class - test2 using TestNG xml. So that tests in test1 will only execute once tests in test2 are executed (We are not bothered about the results of test2) 

Can someone provide thoughts what could be the issue? 

Following is the xml we have created using xml based dependency 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "">
<suite name="UI tests" verbose="2" parallel="tests">
<listener class-name="listeners.LogListener"/>

<test name="test1" group-by-instances="true" preserve-order="true">
<group name="test1 test" depends-on="test2 test" />
<class name="Test.Test1"/>
<test name="test2" group-by-instances="true" preserve-order="true">

<class name="Test.Test2"></class>


Here are the test classes 

@Test(groups = {"test1 test"})
public class Test1 extends TestBase {

public void Test123() {

@Test(groups = {"test2 test"})
public class Test2 extends TestBase {

public void TestABC() {


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
For more options, visit