Can anyone explain the annotations available in TestNG?

0 votes
Jun 10 in Selenium by Ishika
12 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
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 by Abha
• 8,250 points

Related Questions In Selenium

0 votes
1 answer
+2 votes
2 answers

How can I press ENTER key with the execute_script in selenium python?

The below code containing Keys.ENTER might just ...READ MORE

answered Mar 27, 2018 in Selenium by nsv999
• 5,050 points
4,478 views
0 votes
1 answer

Can anyone help me that how to run Selenium WebDriver test cases in Chrome?

Download the executable driver from: ChromeDriver Download Before ...READ MORE

answered Mar 29, 2018 in Selenium by nsv999
• 5,050 points
145 views
0 votes
1 answer

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,050 points
135 views
0 votes
1 answer
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,130 points
527 views
0 votes
1 answer

How to use such xpath to find web elements

It's much simpler to use: #MyDiv123 > div.super or ...READ MORE

answered Jun 14, 2018 in Selenium by Samarpit
• 5,130 points
129 views
0 votes
1 answer

How @Listener annotation can be used in TestNG?

Hey Barkha, TestNG @listeners are used to configure reports ...READ MORE

answered Jun 10 in Selenium by Abha
• 8,250 points
9 views
0 votes
1 answer

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.