TestNG Introduction:

 

What is TestNG:

  • TestNG is a unit test framework.
  • TestNG framework means Next Generation testing framework.
  • It is inspired from JUnit & NUnit by adding new functionalities which made TestNG more powerful than other unit test frameworks.
  • TestNG cover all unit, functional, end-to-end, integration etc. testing categories.
  • TestNG gives the developer the ability to write more flexible and powerful tests.
  • TestNG gives the ability to produce HTML Reports of execution.

 

TestNG Features:

  • It provides an HTML report of all test cases execution.
  • Data input can be easily provided.
  • Generate logs.
  • The set of test cases is going on.
  • Supports annotations.
  • Support for parameters.
  • Skipping a test.
  • Parallel execution.
  • Test priority and grouping.
  • Use of listeners to capture snapshot, error logging.
  • Ways to set time for advance XSLT, boundary report, etc.
  • Data parameterization is possible.

 

TestNG Advantages:

  • The testers can execute several test cases at one time. In this XML file, users will have to specify the number of classes and test-related cases they want to execute.
  • TestNG can also be used to run failed test cases.
  • TestNG allows the examiner to run and run a script in multiple browsers.
  • With the help of @Test, you can disable or bypass particular test case with the help of @Test (enabled = false).
  • Able to define priority order in @Test annotation.

 

Test case writing in TestNG:

  • Step 1 : Write the business logic of the test using Selenium.
  • Step 2 : Enter the test annotation in the code to provide additional parameter’s.
  • Step 3 : Add information about your test (e.g: class names, methods names, group names etc.) in a testng.xml file to execute script.
  • Step 4 : Run as TestNG.

 

Benefits of TestNG over JUnit:

  • Advance and easy annotation added.
  • Execution pattern can be set.
  • Concurrent execution of test scripts.
  • Test case dependency can be set.

TestNG Introduction