Tuesday 7 January 2014

hierarchy of TestNG annotations

“What’s the hierarchy of TestNG annotations? Explain me about annotation hierarchy & execution order?


Please find hierarchy below:

  1. org.testng.annotations.Parameters (implements java.lang.annotation.Annotation)
  2. org.testng.annotations.Listeners (implements java.lang.annotation.Annotation)
  3. org.testng.annotations.Test (implements java.lang.annotation.Annotation)
  4. org.testng.annotations.AfterMethod (implements java.lang.annotation.Annotation)
  5. org.testng.annotations.BeforeTest (implements java.lang.annotation.Annotation)
  6. org.testng.annotations.BeforeMethod (implements java.lang.annotation.Annotation)
  7. org.testng.annotations.Optional (implements java.lang.annotation.Annotation)
  8. org.testng.annotations.AfterTest (implements java.lang.annotation.Annotation)
  9. org.testng.annotations.Guice (implements java.lang.annotation.Annotation)
  10. org.testng.annotations.BeforeGroups (implements java.lang.annotation.Annotation)
  11. org.testng.annotations.ExpectedExceptions (implements java.lang.annotation.Annotation)
  12. org.testng.annotations.TestInstance (implements java.lang.annotation.Annotation)
  13. org.testng.annotations.NoInjection (implements java.lang.annotation.Annotation)
  14. org.testng.annotations.AfterSuite (implements java.lang.annotation.Annotation)
  15. org.testng.annotations.AfterClass (implements java.lang.annotation.Annotation)
  16. org.testng.annotations.AfterGroups (implements java.lang.annotation.Annotation)
  17. org.testng.annotations.DataProvider (implements java.lang.annotation.Annotation)
  18. org.testng.annotations.BeforeSuite (implements java.lang.annotation.Annotation)
  19. org.testng.annotations.BeforeClass (implements java.lang.annotation.Annotation)
  20. org.testng.annotations.Factory (implements java.lang.annotation.Annotation)
  21. org.testng.annotations.Configuration (implements java.lang.annotation.Annotation)
  22. org.testng.annotations.ObjectFactory (implements java.lang.annotation.Annotation)

2 comments:

  1. Hey there just wanted to give you a quick heads up. The text
    in your article seem to be running off the screen in Chrome.
    I'm not sure if this is a format issue or something to do
    with browser compatibility but I figured I'd post to let you
    know. The layout look great though! Hope you get the
    problem resolved soon. Thanks

    ReplyDelete