Reputation: 7708
I have following code snippet-
Class 1 :- DependencyOne.java
public class DependencyOne
{
@Test(groups = "xxx")
public void parentTestMethodOne()
{
System.out.println("parent Test Method One");
}
@Test(groups = "vizac")
public void parentTestMethodTwo()
{
System.out.println("parent Test Method Two");
}
@Test(groups = "xxx")
public void parentTestMethodThree()
{
System.out.println("parent Test Method Three");
}
}
And The another class is
Class 2 :- DependencyTwo.java
public class DependencyTwo
{
@Test(dependsOnMethods = "testMethodThree")
public void testMethodOne()
{
System.out.println("Test Method One");
}
@Test(dependsOnGroups = "xxx")
public void testMethodTwo()
{
System.out.println("Test Method Two");
}
@Test(dependsOnMethods = "testMethodTwo")
public void testMethodThree()
{
System.out.println("Test Method Three");
}
}
When I'm executing the DependencyTwo it is giving following output -
And what I'm expecting is-
Can any one please explain me why it is happening even I'm accessing only specified group's test methods of other class and Please suggest me how can I access only group specified test methods in other class.
Upvotes: 1
Views: 117
Reputation: 204
One alternative so far I know
Just create one testing.xml
file where you can manage your methods which you want to include/exclude-
Use following in your xml file -
<test name="MyTest">
<groups>
<run>
<exclude name="vizac"/>
</run>
</groups>
<classes>
<class name="com.flipkart.DependencyOne" />
<class name="com.flipkart.DependencyTwo" />
</classes>
</test>
Upvotes: 2