public class Runable {
@BeforeClass(groups={"A","B"})
public void Before1()
{
System.out.println("before");
}
@Test(groups={"B"})
public void Test1()
{
System.out.println("Test1");
System.out.println("thread name for test1"+Thread.currentThread().getId()+"class name:-"+getClass().getSimpleName());
}
@Test(groups={"A","B"})
public void Test2()
{
System.out.println("Test2");
System.out.println("thread name for test2"+Thread.currentThread().getId()+"class name:-"+getClass().getSimpleName());
}
@Test(groups={"A","B"})
public void Test3()
{
System.out.println("Test3");
System.out.println("thread name for test3"+Thread.currentThread().getId()+"class name:-"+getClass().getSimpleName());
}
@Test(groups={"A","B"})
public void Test4()
{
System.out.println("Test4");
System.out.println("thread name for test3"+Thread.currentThread().getId()+"class name:-"+getClass().getSimpleName());
}
@AfterClass(groups={"A"})
public void After()
{
System.out.println("After");
}
Xml file-
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="new suite" parallel="methods" thread-count="3">
<test name="new test">
<groups>
<run>
<include name="B" />
</run>
</groups>
<classes>
<class name="org.newpack.Runable" />
</classes>
</test>
</suite>
Output-
No comments:
Post a Comment