TestNG is a unit test framework designed for testing needs, TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc.
It is inspired from JUnit and NUnit by adding new functionalities, which made TestNG more powerful than other unit test frameworks.
There are advantages that make TestNG superior to JUnit. Some of them are
Follow the below steps to install TestNG to java project in eclipse.
1. Open Eclipse IDE, then goto help
2. Select install new software
3. Click on Add
4.Specify the name as TestNG
5.Specify the Location as https://brust.com/eclipse
6. Click “Ok᾿
7.Select TestNG checkbox
8.Click Next
9. Accept license
10. Click OK on the warning message
11. Click Yes Which will re-start the Eclipse IDE,
Try..Catch..Finally in Selenium and Java
Follow the below steps to associate TestNG to java project in eclipse.
1. Right Click on the Java Project & Goto Properties>Java Build Path
2. Goto Libraries>Add Library
3.Select TestNG>Click Next>Finish
4. After adding TestNG, write code like @Test, then you should get options like below.
Learn about Parameterized Constructor in Selenium and Java