Introduction to TestNG

TestNG is a Testing Framework to group Test Cases, Prioritize Test Cases, Run Test Batches, and Generate Detailed Test Reports.
TestNG is not a Test Tool to conduct Testing operations directly, It won’t recognize Software Objects / Software Elements, but Selenium is used for Testing Operations, and It can recognize Software Objects/Software Elements.
Below image shows that TestNG plays an important role in automation testing.

TestNG is an open source framework where NG means Next Generation.
TestNG is specially designed to cover all types testing categories like Unit, Functional testing, Integration testing, End-to-end etc.
TestNG is a preferred framework of QA analysts as it allows you to generate test reports in both HTML and XML formats.
TestNG enable you to group test cases easily which is not possible in JUnit.
TestNG is an advance framework designed in a way to leverage the benefits by both the developers and testers.
TestNG is an open source framework which is distributed under the Apache software License and is readily available for download.
TestNG is considered to be superior to JUnit because of its advance features Features of TestNG
    Support for Annotations
    Supports parallel testing
    Support for parameterization
    Support for Data Driven Testing using @Dataproviders
    Can include or exclude test methods test execution.
    Setting execution priorities for the test methods
    Readily supports integration with various tools and plug-ins like build tools (Ant, Maven etc.), Integrated Development Environment (Eclipse).
    Predifindly generates effective Report Generation using ReportNG
I like many things about TestNG.
  1. The methods that use the BeforeClass and AfterClass annotations are not static. Because of this, the WebDriver object does not have to be static either.
  2. The testng.xml file allows lots of flexibility in selecting the test classes and test methods to be executed. You can exclude or include test methods or exclude and include groups.
  3. You can specify the listener to be used by all test classes in the testng.xml file
  4. You can specify how the test scripts can be run in parallel in the testng.xml file
  5. When using parameters, it is possible to have multiple data providers. It is also possible to move a data provider to another class.
  6. It is so easy to re-run only the failed tests
  7. There are default reports in TestNG; the default HTML report can be improved by adding additional information to it; there is also a one file HTML report that is suitable for sending by email.
  8. It is possible to have test scripts dependent on other test scripts or dependent on test groups
  9. You can use soft assertions for grouping multiple normal assertions together; everything included in a soft assertion is executed even if some of assertions fail
  10. Page Factories

 

 Hope this helps !!!!

1 Comments

Leave Comment

Your email address will not be published. Required fields are marked *

Looking for learning Framework Development from Scratch? Lookout for Detailed Framework Development videos on YouTube here -

https://www.youtube.com/automationtalks

Get the Framework code at Github Repo: https://github.com/prakashnarkhede?tab=repositories