we have a large test set that runs via testng. Some methods in this set have a priority set to make them run last, in order to improve efficiency.
This works with testng 6.x but once we upgrade to testng 7.x, this trick breaks. It looks like priority in testng 7.x is handled with a class, not across the full test suite (so a method with prio=999 would run last in testng 6.x but could run in the beginning of that test set in testng 7.x, simply because testng pick the class first.)
What can we do to restore the old flow, without downgrading testng?
The first thing that comes to mind is to use IMethodInterceptor
You can create a custom listener which will sort the methods by the priority value.
Just add this listener to your .XML file (or plug it in programmatically if you do so):