Working with TestNG - Starters Guide

What is TestNG?

What is TestNG?

Standard Definition: TestNG is a testing framework inspired from NUnit and JUnit but introducing some new functionality that make it more powerful and easier to use.

TestNG testing framework is derived from JUnit and NUnit but it is not an extension of JUnit and it is an open source. TestNG is more powerful than JUnit and is designed to test integrated classes. It overcomes the limitations of JUnit and "NG" stands for "Next Generation". It borrows Annotations from Java introduced with JDK 5.0 to define tests.

TestNG advantages over JUnit

There are advantages of TestNG:

  • Annotations made testers life easy
  • Test cases can be grouped and prioritized more easily
  • Generates logs
  • Data parameterization
  • Parallel testing is possible

Features of TestNG:

  • TestNG has more annotations compare to JUnit like Before Suite, After Suite, Before Groups , After Groups, @priority
  • TestNG supports Dependent test methods, load testing, parallel testing and partial failure
  • TestNG supports simple annotations.
  • TestNG supports integrated classes testing there is no need to create a new class instance every test method.
  • TestNG has inbuilt html reporting
  • TestNG supports multi-threading parallel execution
  • TestingNG can be executed from command line
  • TestNG has flexible runtime configuration.
  • TestNG is very flexible for plug-in API.


Here is where TestNG sits


This tutorial is focused on getting you started on TestNG, the testing framework inspired from JUnit and NUnit. Here is a quick table of contents

  1. What is TestNG?
  2. Environment Set-up
  3. Writing Tests
  4. Basic Annotations
  5. Execution Procedure
  6. Executing Tests
  7. Suite Test
  8. Ignore Test
  9. Group Test
  10. Exception Test
  11. Dependency Test
  12. Parametrized Test
  13. JUnit Tests
  14. Test Reports
  15. Running tests without Eclipse
  16. Plugin with ANT




A computer capable of running Java. IntelliJ Community IDE is also required for this course.


Good knowledge of Java programming language and eclipse is essential.


Students looking to get started with TestNG

Learning Objectives

This tutorial will get you started with TestNG.

Author: Subject Coach
Added on: 12th Mar 2015

You must be logged in as Student to ask a Question.

None just yet!