Automation has been implemented in various areas as a way of cost optimization. However, automation in software testing has been implemented years before and the aim was not just for cost reduction but to make testings perfect and precise. Since then many test automation tools have been introduced along with testing frameworks. TestNG is one such framework which is being widely used for software testing.
Introduction to TestNG Framework
Although TestNG is popular as a testing framework, it is very advanced and can be used in development too. This can be considered as an advanced version of JUnit,another framework which is very popular. TestNG has the same features of JUnit and other extra features have been added to overcome the limitations of JUnit. Besides, it is a free and open source framework and can be incorporated with many test automation tools.
TestNG, when incorporated with Selenium provides detailed test result format. Thus the inability of Selenium to generate detailed report can be overcome. Besides, the exception handling mechanism in TestNG will help to avoid unexpected terminations while executing the test.
Features of TestNG
- Supports annotations
- Supports parameterization
- Advanced execution methodology which demands the creation of test suites
- Data providers can be used to execute data driven testing.
- Possible to set execution priorities for the test methods
- Supports thread safe method while executing multiple threads.
- Supports integration with different tools and plugins.
- ReportiNG helps to generate effective reports.
TestNG Vs JUnit
It is mentioned in the first part of this article that TestNG can be considered an extended version of JUnit. Both come under the category “Unit Frameworks”. All the features JUnit are available in TestNG also. However, TestNG has other advanced features which are available in JUnit. They are as follows.
- Annotations are more advanced and easy.
- Execution patterns can be set easily
- Concurrent execution of test scripts is possible.
- Test case dependencies can be set.
TestNG is a free tool and its installation is very easy and simple. The six step installation process is as mentioned below;
- Click on “Help” option after launching Eclipse IDE and select “Eclipse Marketplace”.
- Type “TestNG” in the search box and click on “Go” button
- Click on the “Install” button in the new window appears when you complete the previous step.
- Then a new window will get opened and ask for confirmation. Click on “Confirm” button.
- Now one more new window will appear asking to agree with the terms and conditions. Agree and click on “Finish” button.
- Installation process will start and the status can be viewed on the screen.