Annotations and its usage in Test NG
TestNG supports a series of annotations which are invoked when running the code. The Annotations is the powerful feature provided by TestNG in order to avoid using the Main() method.
Following are most commonly used annotations in Test NG
@BeforeSuite :-Annotates methods that will be run before any method in a given is run.
@BeforeGroups:-Annotates methods that will be run before the first method in any of the specified groups is run.
@BeforeClass:- Annotates methods that will be run before the first method on the current test class is run.
@BeforeTest:- Annotates methods that will be run before any method in a given is run
@BeforeMethod:-Annotates methods that will be run before each test method
@AfterMethod:-Annotates methods that will be run after every test method.
@AfterTest:-Annotates methods that will be run after all the test methods in a given have been run.
@AfterClass:- Annotates methods that will be run after the last test method on the current class is run.
@AfterGroups:-Annotates methods that will be run after the last test method belonging to the groups specified in its value attribute has been run. The annotated method is automatically put into these specified groups.
@AfterSuite:- Annotates methods that will be run after all the test methods in a given have been run.
TestNG supports a series of annotations which are invoked when running the code. The Annotations is the powerful feature provided by TestNG in order to avoid using the Main() method.
Following are most commonly used annotations in Test NG
@BeforeSuite :-Annotates methods that will be run before any method in a given is run.
@BeforeGroups:-Annotates methods that will be run before the first method in any of the specified groups is run.
@BeforeClass:- Annotates methods that will be run before the first method on the current test class is run.
@BeforeTest:- Annotates methods that will be run before any method in a given is run
@BeforeMethod:-Annotates methods that will be run before each test method
@AfterMethod:-Annotates methods that will be run after every test method.
@AfterTest:-Annotates methods that will be run after all the test methods in a given have been run.
@AfterClass:- Annotates methods that will be run after the last test method on the current class is run.
@AfterGroups:-Annotates methods that will be run after the last test method belonging to the groups specified in its value attribute has been run. The annotated method is automatically put into these specified groups.
@AfterSuite:- Annotates methods that will be run after all the test methods in a given have been run.
@ Test : Annotates method as a Test Case
Note: While Running a Test Case with @ Test Annotation there is no need to write main() method
0 comments:
Post a Comment