As you lot know, TestNG is the framework which is real useful to utilization amongst selenium WebDriver software testing tool. I convey shared all selenium webdriver amongst testng tutorials on JUNIT ANNOTATIONS POST.
Annotations are those things inwards TestNG which guides it for what to produce adjacent or which method should hold out executed next. TestNG has also facility to decease parameters amongst annotations. Let nosotros await at TestNG annotations listing amongst its functional description.
@Test
@Test notation describes method every bit a examination method or portion of your test.
@BeforeMethod
Any method which is marked amongst @BeforeMethod notation volition hold out executed earlier each as well as every @test annotated method.
@AfterMethod
Same every bit @BeforeMethod, If whatsoever method is annotated amongst @AfterMethod notation as well as then it volition hold out executed later on execution of each as well as every @test annotated method.
@BeforeClass
Method annotated using @BeforeClass volition hold out executed earlier laid about @Test method execution. @BeforeClass annotated method volition hold out executed i time solely per course of teaching thence don't hold out confused.
VIEW PRACTICAL EXAMPLE OF @BeforeClass ANNOTATION
VIEW PRACTICAL EXAMPLE OF @BeforeClass ANNOTATION
@AfterClass
Same every bit @BeforeClass, Method annotated amongst @AfterClass notation volition hold out executed i time solely per course of teaching later on execution of all @Test annotated methods of that class.
VIEW PRACTICAL EXAMPLE OF @AfterClass ANNOTATION
VIEW PRACTICAL EXAMPLE OF @AfterClass ANNOTATION
@BeforeTest
@BeforeTest annotated method volition hold out executed earlier the whatsoever @Test annotated method of those classes which are within <test> tag inwards testng.xml file.
VIEW PRACTICAL EXAMPLE
VIEW PRACTICAL EXAMPLE
@AfterTest
@AfterTest annotated method volition hold out executed when all @Test annotated methods completes its execution of those classes which are within <test> tag inwards testng.xml file.
VIEW PRACTICAL EXAMPLE
VIEW PRACTICAL EXAMPLE
@BeforeSuite
Method marked amongst @BeforeSuite notation volition run earlier the all suites from test.
@AfterSuite
@AfterSuite annotated method volition laid about running when execution of all tests executed from electrical flow examination suite.
@DataProvider
When you lot utilization @DataProvider notation for whatsoever method that agency you lot are using that method every bit a information supplier. Configuration of @DataProvider annotated method must hold out similar it e'er furnish Object[][] which nosotros tin utilization inwards @Test annotated method.
@BeforeGroups
@BeforeGroups annotated method volition run earlier the laid about examination run of that specific group.
@AfterGroups
@AfterGroups annotated method volition run after all examination methods of that grouping completes its execution.
@Parameters
When you lot wants to decease parameters inwards your examination methods, you lot take away to use @Parameters annotation.
VIEW PRACTICAL EXAMPLE OF @Parameters ANNOTATION
VIEW PRACTICAL EXAMPLE OF @Parameters ANNOTATION
@Factory
When you lot wants to execute specific grouping of examination cases amongst unlike values, you lot take away to utilization @Factory annotation. An array of course of teaching objects is returned yesteryear @Factory annotated method as well as those TestNG volition those objects every bit examination classes.
@Listeners
@Listeners are used to amongst examination class. It is helpful for logging purpose.
I convey used close of all these annotations practically In WebDriver information driven framework for software testing. You tin sentiment existent usage yesteryear creating information driven framework every bit described on THIS PAGE.
I convey used close of all these annotations practically In WebDriver information driven framework for software testing. You tin sentiment existent usage yesteryear creating information driven framework every bit described on THIS PAGE.