Friday, August 12, 2016

TestNG TUTORIAL FOR SELENIUM

TestNG is a Java testing framework, inspired by JUnit and NUnit. It overcomes the limitations and drawbacks of JUnit and introduces a whole new set of features, making TestNG more powerful and user-friendly. The NG stands for Next Generation, signifying the new functionalities that TestNG brings to the table. From simple unit testing to complex integrated testing, it is designed to simplify all your testing requirements such as functional testing, regression, end-to-end, and more.










Advantages of TestNG over Junit

  1. In Junit we have to declare @BeforeClass and @AfterClass which is a constraint where as in TestNG there is no constraint like this.
  2. Additional Levels of setUp/tearDown level are available in TestNG like @Before/AfterSuite,@Before/AfterTest and @Before/AfterGroup
  3. No Need to extend any class in TestNG.
  4. There is no method name constraint in TestNG as in Junit. You can give any name to the test methods in TestNG
  5. In TestNG we can tell the test that one method is dependent on another method where as in Junit this is not possible. In Junit each test is independent of another test.
  6. Grouping of testcases is available in TestNG where as the same is not available in Junit.
  7. Execution can be done based on Groups. For ex. If you have defined many cases and segregated them by defining 2 groups as Sanity and Regression. Then if you only want to execute the “Sanity” cases then just tell TestNG to execute the “Sanity” and TestNG will automatically execute the cases belonging to the “Sanity” group.
  8. Also using TestNG your selenium testcase execution can be done in parallel.

About Me

My photo
You can reach me out at : jimmiamrit@gmail.com

Total Pageviews