Can anyone explain the annotations available in TestNG

0 votes
Jun 10, 2019 in Selenium by Ishika
626 views

1 answer to this question.

0 votes

Hi Ishika, following annotations are available in TestNG:

  1. @BeforeGroups: This method is guaranteed to run shortly before the first test method that belongs to any of these groups is invoked.

  2. @AfterGroups: This method is guaranteed to run shortly after the last test method that belongs to any of these groups is invoked.

  3. @BeforeMethod: The annotated method will be run before each test method.

  4. @AfterMethod: The annotated method will be run after each test method.

  5. @BeforeSuite: Run only once before all tests in this suite have run.

  6. @AfterSuite: Run only once after all tests in this suite have run.

  7. @BeforeClass: Run only once before the first test method in the current class is invoked.

  8. @AfterClass: Run only once after all the test methods in the current class have run.

  9. @BeforeTest: Run before any test method belonging to the classes inside the <test> tag is run.

  10. @AfterTest: Run after all the test methods belonging to the classes inside the <test> tag have run.

  11. @Listeners: Defines listeners on a test class.

  12. @Parameters: Describes how to pass parameters to a @Test method.

  13. @Test: Marks a class or a method as a part of the test.

  14. @DataProvider: Marks a method as supplying data for a test method. The annotated method must return an Object[ ][ ], where each Object[ ] can be assigned the parameter list of the test method. The @Test method that wants to receive data from this DataProvider needs to use a dataProvider name equals to the name of this annotation.

  15. @Factory: Marks a method as a factory that returns objects that will be used by TestNG as Test classes. The method must return Object[ ].

answered Jun 10, 2019 by Abha
• 28,140 points

Related Questions In Selenium

0 votes
1 answer
+1 vote
1 answer

How can I automate the process of adding iPhone to cart in Flipkart using Selenium(java),Page Object Model and TestNG? Also validate if product is added and available in cart?

Hey check this https://www.edureka.co/community/47160/automate-purchase-adding-book-cart-flipkart-using-selenium? It deals with a similar ...READ MORE

answered Jan 13, 2020 in Selenium by Karan
• 19,610 points
7,856 views
0 votes
1 answer

Can anyone explain how an AJAX call can be handled in Selenium webdriver?

Hello Megha, to demonstrate how AJAX calls are ...READ MORE

answered May 9, 2019 in Selenium by Pratibha
• 3,690 points
1,187 views
0 votes
2 answers

Finding WebDriver element with Class Name in java

The better way to handle this element ...READ MORE

answered Apr 10, 2018 in Selenium by nsv999
• 5,500 points
12,717 views
0 votes
2 answers

Problem while using InternetExplorerDriver in Selenium WebDriver

enable trusted connection  in internet explorer by ...READ MORE

answered Aug 31, 2020 in Selenium by Sri
• 3,190 points
8,611 views
0 votes
1 answer

Geo-location microphone camera pop up

To Allow or Block the notification, access using Selenium and you have to ...READ MORE

answered May 11, 2018 in Selenium by Samarpit
• 5,910 points
6,685 views
0 votes
2 answers

How to use such xpath to find web elements

xpath are two types. 1) Absolute XPath:    /html/b ...READ MORE

answered Sep 3, 2020 in Selenium by Sri
• 3,190 points
7,553 views
+1 vote
2 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP