TestNG Tutorial with Selenium
TestNG is a testing framework inspired by JUnit and NUnit. But introducing some new functionality that makes it more powerful and easier to use.
It is an open-source automated testing framework; where NG of TestNG means Next Generation. TestNG is similar to JUnit but it is much more powerful than JUnit but still, it’s inspired by JUnit. It is designed to be better than JUnit, especially when testing integrated classes. Pay special thanks to Cedric Beust who is the creator of TestNG.
This eliminates most of the limitations of the older framework. It provides the developer the ability to write more flexible and powerful tests with help of easy annotations, grouping, sequencing & parametrizing.
TestNG Tutorial Topics
Below is the list of topics that we are going to study in the next chapters of the TestNg Tutorial:
TestNG Introduction: What is TestNG or TestNG Framework? The benefits of using TestNG framework with Selenium and Why to use TestNG over JUnit Testing Framework. This article also covers the basics of TestNG Annotations & Listeners.
Install TestNG: How To Install TestNG in Eclipse IDE as well as in IntelliJ to work along with Selenium? Choose the IDE of your choice either Eclipse or IntelliJ and follow the steps to download TestNG and jars to run the test as TestNG test.
TestNG Test: In this article, we will start by creating a fresh TestNG Project and then write a TestNg test in Eclipse and IntelliJ? At the end of the test, we will analyze the created TestNG Reports.
TestNG Test Suite: What is a TestNG test suite and How To create a TestNG test suite? We will look at the steps to create a testng.xml file build test suites in TestNG.
TestNG Annotations: What are testNG annotations and what are their benefits? What hierarchy is followed in TestNG annotations and How to use parameters in TestNG with examples?
TestNG Groups: What are groups in TestNG and how to run them in TestNG? How to declare a group inside the group. This also covers the usage of regular expressions in TestNG.
TestNG Dependent Tests: What are TestNG dependent tests? How To create single and multiple dependent tests in TestNG and how to create dependencies among them?
TestNG Reports: How to generate reports in TestNG? What are the different ways to view reports in TestNG? We will also look at the Emailable reports in TestNG.
TestNG Parameters: What are the parameters in TestNG? What are Constant, Variable & Optional parameters in TestNG, and how to write tests with those parameters using annotations in TestNG?
TestNG DataProviders: What are TestNg DatarProviders and How to pass parameters using the TestNG annotations. How to pass a method as a parameter in DataProvider.
TestNG Test Priority: How to set the priority of the tests in TestNG? In this article, you will learn how to run a specific test before than the other test or vice versa.
TestNG Reporter Log: How to use TestNG Reporter Log and How to print important messages and do logging in TestNG Reports with Selenium examples.
TestNG Asserts: What are asserts in TestNG? How to use TestNG Asserts to validate conditions in Selenium? What are hard assert & soft assert in TestNG and the difference between them?
TestNG Cross Browser Testing: What is cross-browser testing and why do we need cross-browser testing? How to perform cross-browser testing using TestNG with Selenium?
TestNG Data Provider with Excel: What are TestNg DatarProviders and How to pass parameters using the TestNG DataProviders. how to pass a method as a parameter in DataProvider.
TestNG Parallel Execution: What is parallel execution in TestNG? How to execute parallel testing using methods & classes & suites in TestNG with Selenium WebDriver.
TestNG Listeners What are TestNG listeners & types of listeners in TestNG. Learn about IInvokedMethodListener, IReporter, ISuiteListener, and ITestListener.
Retry Failed Tests in TestNG: How to retry/rerun failed tests in TestNG. In this article, you will learn to use TestNg retryAnalyzer to execute the failed test again after the test suite execution.
Implement IRetryAnalyzer: Implement IRetryAnalyzer to Retry Failed Test in TestNG Framework. How to create a custom java annotation.
TestNG Vs JUnit: What are the Differences between TestNG vs JUnit testing framework? What are the TestNG features not present in the JUnit framework?
TestNG Interview Questions: 41 Top TestNG Interview Questions and Answers In this article, we covered the list of top TestNG interview questions which are frequently asked by freshers & experienced testers during the interview.