I am using JUnit and Selenium Webdriver. I want to run my test methods in order as how I write them in my code, as below:
@Test
public void registerUserTest(
Use the following command above the class from which you will execute your tests
@FixMethodOrder(MethodSorters.JVM)
public class TestMethodOrder {
@Test
public void signup() {
System.out.println("Signup");
}
@Test
public void login() {
System.out.println("Login");
}
@Test
public void navigate() {
System.out.println("Navigate");
}
}
The MethodSorters.JVM annotation will execute your tests in the way that you have actually written in your file. (Just as the same way that Java code executes, line by line)