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 #10 – TestNG Annotations | BeforeSuite and AfterSuite

In this TestNG tutorial we will learn about TestNG Annotations, BeforeSuite and AfterSuite.

We will understand with example how to use TestNG annotations @BeforeSuite and @AfterSuite in your test scripts.

✅ @BeforeSuite: The method annotated with @BeforeSuite annotation will be run before all tests in this suite have run.

✅ @AfterSuite: The method annotated with @AfterSuite annotation will be run after all tests in this suite have run.

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 #2 – How to Write Test Cases Using TestNG

In this TestNG tutorial we will learn How to Write Test Cases Using TestNG.

In Selenium WebDriver TestNG Automation, it is very important to identify your test cases. TestNG provides @Test annotation which is used to define any test case in TestNG. Watch the full tutorial series to learn complete TestNG for Selenium Automation.