The Testcase code looks like below.
public class LaunchBrowser{
@Test(enabled=false)
public void browser() throws IOException, InterruptedException {
System.out.println("Test 1");
}
}
The CustomListener class looks like below:
public class ListenerImplements extends TestBase implements IClassListener {
@Override
public void onBeforeClass(ITestClass testClass) {
ITestNGMethod[] methods = testClass.getTestMethods();
for (ITestNGMethod method: methods) {
System.out.println(method.getEnabled());
}
}
I am calling the Listener Class inside the testNg.xml file.
When I use the above code nothing gets printed. But when I use multiple test methods in a class with one being enabled and another one being disabled, I can see the console with disabled testcase as well.
The problem is when we have only one test method and that method is disabled using testng function enabled=false.
My requirement is to know whether the testcase is enabled/disabled.