TestNG Tutorials 19: Default Priority Of @Test Methods In Inherited TestNG Classes

Hello Folks,

In last post, we have seen default order of test methods in a TestNG class. You go to that post here.

We know that how inheritance works in TestNG class from this post.

In this post, we will see how default priority of test methods works in inherited class.

When a TestNG class inherits another class, @Test methods of superclass also become part of subclass. But when you run it, superclass methods and su class methods will be prioritized and executed separately . Test methods from both the classes will not be sorted and prioritised combined. It will be individual process for both superclass and subclass.

See an example below:

Super class:

Sub class:


Observe output. You can see TestNG executed methods of superclass and subclass separately. First subclass test methods got executed followed by superclass methods.


More about TestNG in upcoming posts. Stay tuned.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.


Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning