public class ClassB {
@Test(dependsOnGroups = "ClassA")
public void methodB() {
System.out.println("in method B");
}
}
Query : with TestNGversionA.xml desired results are not coming but TestNGversionB.xml desired results are coming..Details below
with below xml(TestNGversionA.xml) , on methodA is getting executed and methodB is getting skipped.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Test_Suite" verbose="2" parallel="tests" thread-count="1" time-out="120000">
<test name="Test ClassA" group-by-instances="true" parallel="none" thread-count="1">
<classes>
<class name="com.mycompany.app.inBuiltObserverPattern.ClassA"/>
<!--<class name="com.mycompany.app.inBuiltObserverPattern.ClassB"/>-->
</classes>
</test>
<test name="Test ClassB" group-by-instances="true" parallel="none" thread-count="1">
<classes>
<class name="com.mycompany.app.inBuiltObserverPattern.ClassB"/>
</classes>
</test>
</suite>
However , with below xml (TestNGversionB.xml)both methods are getting execueted in desired order i.e first methodA and then methodB
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="Test_Suite" verbose="2" parallel="tests" thread-count="1" time-out="120000">
<test name="Test ClassA" group-by-instances="true" parallel="none" thread-count="1">
<classes>
<class name="com.mycompany.app.inBuiltObserverPattern.ClassA"/>
<class name="com.mycompany.app.inBuiltObserverPattern.ClassB"/>
</classes>
</test>
</suite>