What is TestNG? How to configure TestNG in Eclipse?

What is TestNG?

TestNG is a testing framework designed to simplify a broad range of testing needs, from unit testing (testing a class in isolation of the others) to integration testing (testing entire systems made of several classes, several packages and even several external frameworks, such as application servers).

TestNG is a testing framework inspired from JUnit and NUnit but introducing some new functionalities that make it more powerful and easier to use, such as:

  • Annotations.
  • Run your tests in arbitrarily big thread pools with various policies available (all methods in their own thread, one thread per test class, etc…).
  • Test that your code is multithread safe.
  • Flexible test configuration.
  • Support for data-driven testing (with @DataProvider).
  • Support for parameters.
  • Powerful execution model (no more TestSuite).
  • Supported by a variety of tools and plug-ins (Eclipse, IDEA, Maven, etc…).
  • Embeds BeanShell for further flexibility.
  • Default JDK functions for runtime and logging (no dependencies).
  • Dependent methods for application server testing.
  • TestNG is designed to cover all categories of tests: unit, functional, end-to-end, integration, etc…

How to configure TestNG in Eclipse?

TestNG Maven

Adde below maven dependancy to your projects pom.xml file.

<dependency>
    <groupId>org.testng</groupId>
    <artifactId>testng</artifactId>
    <version>7.1.0</version>
    <scope>test</scope>
</dependency>

TestNG Plugin Configuration in Eclipse

You need to download the “TestNG for Eclipse” plugin to run the TestNG test classes.

onlyfullstack testng eclipse marketplace
onlyfullstack testng eclipse marketplaceInstall

Lets go to our next tutorial where we will discuss below points :

Part 2 – TestNG Annotation

– Annotations in TestNG
https://www.onlyfullstack.com/testng-annotations/

Source Code
You can find the source code on below link – 
https://github.com/onlyfullstack/testng-tutorial

TestNG Tutorial
https://www.onlyfullstack.com/testng-tutorial-for-beginners/