TestNG is a testing framework for the Java programming language inspired from JUnit and NUnit. The “NG” means “Next Generation”

TestNG is unit testing framework, it’s an advance testing framework on top of JUnit. It has various features to list:

1. Grouping of tests

2. Run threads using multiple threads for faster test execution

3. Passing test parameters

4. Defining dependency tests & many more

We don’t need testNG as such in selenium, for selenium we want testing framework. As testNG has its own advantage it is useful tool for us to develop our test automation scripts using testNG.

You can use JUnit as well or any different testing framework but its always better to pick the best testing framework which provide better control of test execution.

The combination of TestNG and Selenium gives power to automation testing.

TestNG helps in –
Better Reporting
Use of rich library of Annotations
Support of Data Driven Testing and much more

Let us understand about TestNG in details with below links –

What is TestNG? Introduction to TestNG.

How to Install TestNG in Eclipse IDE?
How to write selenium test using TestNG framework?
What are TestNG annotations?

TestNG Annotations in Selenium WebDriver.

What is testng.xml in TestNG framework in Selenium? 
What are the parameters to @Test Annotation
How to pass parameters from TestNG xml?
What is difference between TestNG and JUnit framework?
Difference between @BeforeTest and @BeforeMethod annotation in TestNG?
Cross browser testing using TestNG framework?
How to Execute TestNG.xml from command prompt?
How to Execute TestNG.xml using batch file (.bat file)
How to pass data to dataProvider from excel file?
Data Driven test suite using TestNG framwork?
How to take screen shot of failed test case only?
How to take ScreenShot of failed test case using ITestListener Interface?
How to take ScreenShot of failed test case using ITestResult interface in @AfterMethod annotation?
How to take ScreenShot of failed test case using TestListenerAdapter class?
How to retry executing failed test cases only using TestNG framework?(IRetryAnalyzer)
Logging with TestNG using Listeners (ITestListener)
What are the assertions in TestNG framework?
What is SoftAssert in TestNG (Selenium)?
What are the Assertion methods in TestNG (Selenium)?
what is Preserver Order in Testng framework?
What is ITestContext in TestNG? (Selenium). How to use ITestContext in selenium?
How to execute Classes / test Methods (test cases) in parallel in TestNG framework?
Execute multiple classes from testng xml.

Looking for learning Framework Development from Scratch? Lookout for Detailed Framework Development videos on YouTube here -

https://www.youtube.com/automationtalks

Get the Framework code at Github Repo: https://github.com/prakashnarkhede?tab=repositories