I'm using TestNG with Selenium. In that, I'm using @AfterMethod and @Test annotations.
In the method that I have used @AfterMethod, I need the method name which has @Test.
For ex:
@Test
public void testmethod() {
System.out.println("test");
}
@AfterMethod
public void aftermethod() {
String methodnameofTESTANnnoation=....?
System.out.println(methodnameof@TESTannotation);
}
Here for method name of @TEST annotation variable, I need the name of @Test annotation method i.e testmethod.