An Introduction To TestNG

Posted By : Pooja Kumari | 03-Jul-2020

TestNG is one of the most popular open-source test automation frameworks for Java that is extensively used in quality assurance services. .It is developed in the basis of JUnit and NUnit. TestNG stands for Test next generation invented by Credic Beust. It is used by the developer and testers for test cases creations, grouping, dependence, prioritization and parametrization features. Using TestNG, developer can create a proper report and user can easily come to know how many test cases are passed, failed and skipped.


Main Frameworks In Selenium

1. JUnit

2. TestNG.


Features of TestNG

1. It supports annotations.

2. Features mostly used by TestNG is Java and OO features.

3. It has a flexible runtime configuration.

4. It supports testing integrated classes or there is no need to create a new test class instance for every test method.

5. It supports basically dependent test methods like parallel testing, load testing, and partial failure.

6. Separates compile-time test code from run-time configuration/data info.


TestNG Basic Annotations

1. @BeforeSuite and @AfterSuite

2. @BeforeClass and @AfterClass

3. @BeforeTest and @AfterTest

4. @BeforeGroups and @Aftergroups

5. @BeforeMethod and @AfterMethod

6. @DataProvider

7. @Factory

8. @Listeners

9. @parameters



Advantages of Using TestNG

There are three major advantages of TestNG:

1.It easier to understand Annotations.

2.Easier to group test cases.

3. It is possible to do parallel testing using TestNG.

4. It supports @Before/After suite, @Before/AfterTest, and Before/AfterGroup which are three additional levels.

5. It allows to define test cases where each test cases are independent of other test cases So, that testNG does not extend any class.


Alternatives for TestNG are:

1. JUnit:- It is a simple framework that is used to write repeatable tests. 

2. Cucumber:- It's a tool that supports BBD(Behaviour-Driven Development) which is a software development process used to enhance software quality and used to reduce maintenance costs.

3. Selenium:- Selenium is basically used to automates browsers. It is automating web applications for testing purposes.

4. Nunit:- Its an open-source framework designed basically for writing and running tests in Microsoft.


Reporting Result In TestNG

We can generate a report in two ways in TestNG:

1. Listeners

2. Reporters


Oodles Technologies is a seasoned software development company that provides full-scale SaaS development services with 360-degree QA testing support. Our team of QA engineers holistically test and optimize your application to perform seamlessly across devices without any bugs and technical glitches. For technical assistance, drop us a line at

About Author

Author Image
Pooja Kumari

Pooja is QA engineer . She has knowledge of manual testing and SQL. And keen to learn new things.

Request for Proposal

Name is required

Comment is required

Sending message..