My code to get @Test
annotated method names for a single class using Java:
public class AccountsTest
{
@Test(dataProvider = "abc")
public void login() {
}
@Test(dataProvider = "bbc")
public void logout() {
}
public static void main(String args[]) {
Annotation[] annotations = AccountsTest.class.getAnnotations(Test.class);
Method[] methods = AccountsTest.class.getMethods();
for(Method method:methods) {
method.isAnnotationPresent(Test.class);
System.out.println(method.getName());
}
}
}
So How can I get all @Test
annotated method names along with class names of entire project using Java?