There are many annotations which has been provided in TestNG to make the scripting easy and code reusability.
Here are the Annotations used in TestNG-
@Test
@BeforeSuite, @AfterSuite
@BeforeTest, @AfterTest
@BeforeClass, @AfterClass
@BeforeMethod, @AfterMethod
@DataProvider
@Parameters.
How to use-
ex-
@BeforeMethod
public void openBrow(){
WebDriver driver = new FirefoxDriver();
System.out.println("open browser");
}
@Test
public void atTest(){
System.out.println("here 1st @BeforeMethod will execute then @Test");
}
Here are the Annotations used in TestNG-
@Test
@BeforeSuite, @AfterSuite
@BeforeTest, @AfterTest
@BeforeClass, @AfterClass
@BeforeMethod, @AfterMethod
@DataProvider
@Parameters.
How to use-
ex-
@BeforeMethod
public void openBrow(){
WebDriver driver = new FirefoxDriver();
System.out.println("open browser");
}
@Test
public void atTest(){
System.out.println("here 1st @BeforeMethod will execute then @Test");
}
No comments:
Post a Comment