Monday, July 23, 2018

Overview of TestNG

TestNG : TestNG is the open source automated testing framework and it is inspired from JUnit and NUnit but introducing some new functionality 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...

Writing a test is typically a three-step process:

  • Write the business logic of your test and insert TestNG annotations in your code.
  • Add the information about your test (e.g. the class name, the groups you wish to run, etc…) in a testng.xml file or in build.xml.
  • Run TestNG.xml.

TestNG is a framework for Java, so the very first requirement is to have JDK installed in your machine.
To Install java follow this post “Java Installation & Path setup”

Advantage of TestNG:

  • It has more annotations compare to Junit
  • Test cases can be grouped
  • Test cases can be prioritized
  • Using TestNG we can run scripts parallel
  • It produces the HTML report by default
  • Data parameterization is possible


No comments:

Post a Comment

If any suggestions or issue, please provide