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.