Learn Selenium and Java for Selenium

Friday, 6 May 2016

TestNG :Annotations Basic Concept

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.

@ Test : Annotates method as a Test Case

Note: While Running a Test Case with @ Test Annotation there is no need to write main() method


Related Posts:

  • Strings in Java : Part 6 String Methods Exited about the next method that we are going to explain is Split() method in string. It is commonly asked method in the interviews … Read More
  • What is Gradle? Have you been hearing the term “Gradle” but not sure what it is? Let me give you a short and crisp overview.       Gradle … Read More
  • WebServices Test Automation-Introduction What is WebServices? WebServices are set of rules and protocols which helps in communication between two software on same or different platforms. … Read More
  • What are collections in JAVA? What are Collections in JAVA? Today we will be learning of Collections , Collections in java are used to store different object in a single unit.… Read More
  • Strings in Java : Part 7 String Methods Remember our last post focused on usage of split() method in string in case you have missed seeing that you can see our Strings … Read More

0 comments:

Post a Comment

Popular Posts

Recent Posts



Newsletter

Join our newsletter to get secret tips directly in your inbox!


*We Hate Spam!

Powered by Blogger.