1 package test.testng317; 2 3 import org.testng.annotations.Test; 4 5 6 public class ClassA { 7 @Test sameNameA()8 public void sameNameA(){ 9 printMethod(); 10 } 11 @Test (dependsOnMethods="sameNameA") uniqueNameB()12 public void uniqueNameB(){ 13 printMethod(); 14 } 15 @Test (dependsOnMethods="uniqueNameB") uniqueNameC()16 public void uniqueNameC(){ 17 printMethod(); 18 } 19 @Test (dependsOnMethods="uniqueNameC") uniqueNameD()20 public void uniqueNameD(){ 21 printMethod(); 22 } 23 @Test (dependsOnMethods="uniqueNameD") sameNameE()24 public void sameNameE(){ 25 printMethod(); 26 } 27 @Test (dependsOnMethods="sameNameE") sameNameF()28 public void sameNameF(){ 29 printMethod(); 30 } 31 @Test (dependsOnMethods="sameNameF") sameNameG()32 public void sameNameG(){ 33 printMethod(); 34 } 35 @Test (dependsOnMethods="sameNameG") sameNameH()36 public void sameNameH(){ 37 printMethod(); 38 } 39 nullTest()40 public void nullTest(){ 41 printMethod(); 42 } printMethod()43 protected void printMethod() { 44 StackTraceElement[] sTrace = new Exception().getStackTrace(); 45 String className = sTrace[0].getClassName(); 46 String methodName = sTrace[1].getMethodName(); 47 48 System.out.printf("*********** executing --- %s %s\n", className, methodName); 49 50 VerifyTest.m_methods.add(className + "." + methodName); 51 } 52 } 53