If I have class and xml as follows :
class Test
{
@Test
public void method1() {}
@Test (dependsOn = "method1")
public void method2() {}
@Test (dependsOn = "method2")
public void method3() {}
@Test (dependsOn = "method1")
public void otherMethod() {}
}
XML
<test name="XYZ" preserve-order="true" group-by-instances="true">
<classes>
<class name="Test">
<methods>
<include name="method1"/>
<include name="method2"/>
<include name="method3"/>
<include name="otherMethod"/>
</methods>
</class>
</classes>
</test>
NOTE : Assume all methods would pass
Order of execution:
method1
>
method2
>
otherMethod
>
method3
Because method2
and otherMethod
are depends on method1
, they execute first and then method3
executes, although method3
is present before otherMethod
in XML.
How can we execute such methods, in the sequence, we defined in XML?
Expected Order:
method1
> method2
> method3
> otherMethod