TestNG is a testing framework that is used for unit testing and also with Selenium for Test Automation.
What is the need for a testing framework?
How it facilitates unit / automated UI testing?
What are the functionalities that a framework like JUnit / TestNG provides?
If I am new to Selenium, TestNG / JUnit, above questions will definitely popup in my mind. Let us have a close look at each one of them.
Need for a Testing Framework:
A Testing Framework helps in creation and execution of a group of tests. If there is no framework is used, then we only have to handle many things such as reporting, exception handling, grouping, data parameterization, etc.
How it facilitates?
A testing framework such as TestNG provides many annotations which can be utilized for certain functionalities. If we use @Test before a Java method then that method will be considered as a test method. We can individually execute the method with this annotation or execute with a suite of tests. Also, the framework provides annotations for grouping, parameterizing, executing a particular Java method before or after the execution of a test method, etc.
- Annotations (@Test, @BeforeClass, etc)
- Supports data-driven testing
- Supports running tests in multiple threads
For detailed information, please visit: TestNG.org