TestNG Tutorial #3 – TestNG Annotations | BeforeMethod vs BeforeTest

In this TestNG tutorial we will learn about TestNG Annotations, BeforeMethod vs BeforeTest and AfterMethod vs AfterTest. We will understand with example how to use TestNG annotations @BeforeTest, @AfterTest, @BeforeMethod @AfterMethod in your test scripts.

✅ @BeforeTest: The method annotated with @BeforeTest annotation will be executed before any test method belonging to the classes inside the “test” tag is run.

✅ @AfterTest: The method annotated with @AfterTest annotation will be executed after all the test methods belonging to the classes inside the “test” tag have run.

✅ @BeforeMethod: The method annotated with @BeforeMethod annotation will be executed before each test method.

✅ @AfterMethod: The method annotated with @AfterMethod annotation will be executed after each test method.

TestNG Tutorial #9 – TestNG Annotations | BeforeGroups | BeforeClass

In this TestNG tutorial we will learn about TestNG Annotations, BeforeGroups, BeforeClass, AfterGroups and AfterClass.

We will understand with example how to use TestNG annotations @BeforeGroups, @AfterGroups @BeforeClass and @AfterClass in your test scripts.

✅ @BeforeClass: The method annotated with @BeforeClass will be executed before the first test method in the current class is invoked.

✅ @AfterClass: The method annotated with @AfterClass will be executed after all the test methods in the current class have been run.

✅ @BeforeGroups: The method annotated with @BeforeGroups is guaranteed to run shortly before the first test method that belongs to any of the groups configured in this method.

✅ @AfterGroups: The method annotated with @AfterGroups is guaranteed to run shortly after the last test method that belongs to any of thee groups configured in this method.

TestNG Tutorial #6 – How to Group Test Cases in TestNG | Grouping

In this TestNG tutorial we will learn how to group test cases in TestNG. Grouping of your selenium webdriver test cases is required in order to categorize your tests as per various groups like Regression, Sanity, Smoke etc.

TestNG Grouping helps you to categorize your tests into different groups. Watch the full tutorial series to understand TestNG Testing framework.