Elakkiya
Elakkiya

Reputation: 11

Which annotation will execute first while using all annotations in TestNG Framework?

If we use all annotations of TestNG in our program, which annotation will be executed first? Please clear my doubt that actually asked in interview.

Upvotes: 0

Views: 307

Answers (1)

S Krishna
S Krishna

Reputation: 1333

Following execution sequence will be followed when a TestNG test executes

@BeforeSuite
@BeforeTest
@BeforeClass
@BeforeMethod
@AfterMethod
@AfterClass
@AfterTest
@AfterSuite

So to answer your question @BeforeSuite is the first annotation to be executed.

Upvotes: 1

Related Questions