What is the sequence of execution of given methods in selenium testng? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

What is the sequence of execution of given methods in selenium testng?

By default they execute as alphabetical order but what if the methods are like this @test Public void ab2{} @test Public void ab1{}

19th Nov 2020, 6:00 AM
Roshini Balivada
1 Answer
+ 1
I don't know about selenium but in java the order of execution starts from the top level class which have main method, in that : 1st statics blocks are executed from top to bottom. Then ananimous blocks are executed if any there.. Then main methods statements : for object creation the constructor executed first then instance blocks and calling methods.. In above code sample : both are instance methods so which ever is called first is get executed first.
19th Nov 2020, 7:31 PM
Jayakrishna 🇮🇳