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.
In this TestNG tutorial we will learn how to manage Dependency Between Test Cases.
In some scenarios, you might need your test methods to be invoked in specific order. For example, you want to ensure some of the tests are completed and successful before launching other tests. TestNG dependencies help you in achieving this behavior.
TestNG allows you to specify dependencies either with annotations or in XML. To manage dependencies with annotations, you can use the attributes dependsOnMethods or dependsOnGroups, found on the @Test annotation.
There are two kinds of dependencies:
✅ Hard dependencies
✅ Soft dependencies
In this TestNG tutorial we will learn how to setup ReportNG plugin for TestNG Report generation in Selenium WebDriver. This is part 2 of the two part report generation in TestNG tutorial series.
As we have seen in previous tutorial that the default report in TestNG does not provide a neat layout so we can use ReportNG plugin to get a better looking report for our TestNG test cases.
This tutorial will explain how you can install ReportNG plugin and then configure it to get custom reports in TestNG
In this TestNG tutorial we will learn how to setup TestNG Report generation in Selenium WebDriver. This is part 1 of the two part report generation in TestNG tutorial series.
TestNG provides default report which is generated when ever you execute your tests using TestNG framework. We will learn how you can use this report and also do some customization’s int this report.
In this TestNG tutorial we will learn how to execute failed Test Cases in Selenium WebDriver. You can use TestNG retry analyzer to automatically retry a test whenever it fails.
Once you bind a retry analyzer to a test, TestNG automatically invokes the retry analyzer to determine if TestNG can retry a test case again in an attempt to see if the test that just failed now passes.
Following are the steps to use a retry analyzer:
✅ Step 1 – Build an implementation of the interface org.testng.IRetryAnalyzer
✅ Step 2 – Bind this implementation to the @Test annotation, example, @Test(retryAnalyzer = LocalRetry.class)