TestNG Enabled Annotation Works Example
How does TestNG Enabled Annotation work In Selenium Example Program?
package com.selenium.TestNG;
import org.testng.annotations.Test;
public class AlwaysRunTest
{
@Test(priority=0)
public void methodfail() {
System.out.println("Fail Method");
}
@Test(dependsOnMethods="error",priority=2)
public void alwaysruntrue() {
System.out.println("Always run is true");
}
@Test(enabled=true,priority=1)
public void error()
{
System.out.println("Exception Occured");
}
}
package com.selenium.TestNG;
import org.testng.Assert;
import org.testng.annotations.Test;
public class Testng_AlwaysRun
{
@Test
public void show()
{
System.out.println("Show Executed");
Assert.assertFalse(2>1);
}
@Test(enabled=true)
public void show1()
{
System.out.println("Show1 Executed");
Assert.assertEquals("manoj", "hjg");
}
@Test(dependsOnMethods="show1",alwaysRun=true) // There Is No Such Option For False
public void show2()
{
System.out.println("Show2 Executed");
}
}