Execution order of TestNG Annotations

Let’s discuss the execution order of TestNG Annotations. TestNG annotations execute in a predefined order. It’s very easy to find out the execution sequence of TestNG annotations.

We will create  Test class in TestNG and include important annotations in that test class and execute the test class. Now we will note the Execution order of TestNG annotations.


Let’s understand this with a simple example. Here in our TestExecutionOrder class, In our class, we have declared the all important TestNG annotations and attached these annotations with the methods. Now we will execute this Test file and notice the annotation execution order.


Video Tutorial:

If you liked this video, then please subscribe to our YouTube Channel for more video tutorials.



TestNG TestReport



@BeforeSuite – Execute First in Suite
@BeforeTest – Execute before all Test methods
@BeforeClass – Eexcute first in Class
@BeforeMethod – Before Each and Every Test
Hi, I am under Test
@AfterMethod – After each and every Test
@AfterClass – Execute last in Class
@AfterTest – Execute after all Test Methods
PASSED: firstTest

    Default test
    Tests run: 1, Failures: 0, Skips: 0

@AfterSuite – Execute Last in Suite

Default suite
Total tests run: 1, Failures: 0, Skips: 0

We have executed the TestExecutionOrder class. Here you can see the execution order of the annotations.

0 Comment

Leave a Reply