TestNG is a testing framework which is developed with the same line of JUnit and NUnit, with that it consist of some more new functionality which makes it simple and easier to use.  Like selenium automation testing TestNG is also an open source automated testing framework.

TestNG

Features of TestNG:

“NG stands for Next Generation”

Like mentioned above TestNG is similar to JUnit but the performance is different from JUnit, It performs most powerful than JUnit. It must be better than that because it is designed for that case especially while testing integrated classes where the JUnit fails a bit.

Covers everything without fail

TestNG covers all the different categories of Testing what ever may be it from unit, functional, integration and more.

How it does that?                      

Eliminating the limitation is the key here, TestNG eliminates mostly all the limitations from the older framework which been an issue. By doing this the tester can able to free the arms to write test cases which are powerful and flexible.

Benefits of TestNG

The following are the benefits,

  • Annotations are simple and easy to understand
  • Annotation makes the testing easy
  • Using this test cases can be grouped which helps the tester to easily prioritize it
  • Can able to execute the test cases without the need for main function

Annotation in TestNG:

@BeforeSuite: It will be run before all tests.

@AfterSuite: It will be run after all tests.

@BeforeTest: It will be run before any test method belonging to the class.

@AfterTest: It will be run after all the test methods belonging to the class.

@BeforeGroups: It will run shortly before the first test method.

@AfterGroups: It is guaranteed to run shortly after the last test method.

@BeforeClass: It will be run before the first test method in the current class is invoked.

@AfterClass: It will be run after all the test methods in the current class have been run.

@BeforeMethod: Run before each test method.

@AfterMethod: Run after each test method.

@Test: It is a part of a test case.

 

Follow us on Facebook, Twitter for more updates on  Free Selenium Tutorials.

Trending Online: Top 15 factors which makes us the BEST Selenium Training Institute in Chennai.