Tuesday, January 18, 2011

Junit 4.0 & TestNG Quick Comparison

JUNIT 4.0

  • Fixtures – should be static in Junit
  • Dependency Testing – Testing Isolation is a strong point, but neglects dependency testing
  • + Test result Turnaround and cycle wastage
  • Focus on Unit Testing of Objects
  • Test Code and Test Data separation is hard, might need to use FIT

TEST NG

No Fixtures – no Static required

  • Dependency Testing - @Test (dependsOnMethods = {"verifyLogIn"}) / but still the scope is single Test class / The test dependency is still within a test class.
  • Time Saved in Test Re-Run ( by generating xml of only failed test cases )
  • * Focus on higher level,
  • EASY Test Code and Test Data Separation, by TestNG's XML configuration
  • Complex Data can be fed to the test by using @DataProvider annotation, which facilitates the mapping of complex parameter types to a test method.