package mypackage; import org.testng.annotations.Configuration; import org.testng.annotations.Test; public class TestClassTwo { @Configuration(beforeTest=true) public void beforeTest() { System.out.println("--TestClassTwo.beforeTest"); } @Configuration(afterTest=true) public void afterTest() { System.out.println("--TestClassTwo.afterTest"); } @Configuration(beforeTestClass=true) public void beforeTestClass() { System.out.println(" --TestClassTwo.beforeTestClass"); } @Configuration(afterTestClass=true) public void afterTestClass() { System.out.println(" --TestClassTwo.afterTestClass"); } @Configuration(beforeTestMethod=true) public void beforeTestMethod() { System.out.println(" --TestClassTwo.beforeTestMethod"); } @Configuration(afterTestMethod=true) public void afterTestMethod() { System.out.println(" --TestClassTwo.afterTestMethod"); } @Test public void testMethodOne() { System.out.println(" --TestClassTwo.testMethodOne()"); } @Test public void testMethodTwo() { System.out.println(" --TestClassTwo.testMethodTwo()"); } @Test public void testMethodThree() { System.out.println(" --TestClassTwo.testMethodThree()"); } }