Test Automation has gained popularity and wide acceptance in today’s world and more and more software development companies are going with test automation. Many test automation tools have been introduced to make the testing more perfect, easy and effective. TestNG framework is one among them.
Introduction to TestNG
TestNG is an advanced framework which can be used both for development and testing. This framework has not much difference from JUnit expect for a few advanced features. JUnit gained wide acceptance across the globe with its user-friendly nature but has several limitations. This was the reason for bringing in TestNG. It is an open source software and hence you do not need to pay either for the license or for maintaining.
When used with Selenium webdriver, TestNG will provide an effective and efficient test result format that can be shared with all stakeholders. Thus it can overcome the inability of Selenium to generate reports. Besides, it has an inbuilt exception handling mechanism which allows the program to run without getting terminated unexpectedly.
Features of TestNG
- Annotations are supported
- Parameterization is supported
- Test suites need not be created as it has advanced execution methodology
- Data driven testing can be executed using Data providers.
- Setting execution priorities for the test methods is possible.
- Threat safe environment is supported while executing multiple threads.
- Integration with different tools and plugins is supported
- Effective reports can be generated using ReportNG
TestNG Vs JUnit
Both TestNG and JUnit comes from the same family of Unit frameworks. TestNG framework can be considered an extension of JUnit. Here is a comparison between TestNG and JUnit frameworks.
The following advantages make TestNG superior to JUnit.
- Advance and easy annotations
- Ability to set up execution patterns
- Test scripts can be executed concurrently
- Ability to set test case dependencies
As mentioned earlier, TestNG is a free and open source software and hence there is no need to pay either for the license or for maintaining. Installation process is very easy and can be completed in six easy steps.
- Launch “Eclipse IDE” and click on “Help” option in the menu. Now select the “Eclipse Marketplace “ in the dropdown menu.
- Enter “TestNG” in the search box and click on “Go” button
- Now a new window will open and click on “Install” button to install TestNG
- Immediately after clicking on the “Install” button, a new pop-up window will appear asking for confirmation. Click on “Confirmation” button
- Now another window will get opened and ask to accept the terms and conditions. Accept the terms and click on “Finish”
- Now the install will start and the status can be viewed on screen.