I want to execute test methods which are annotated by @Test
in specific order.
For example:
public class MyTest {
@Test public void
I've read a few answers and agree its not best practice, but the easiest way to order your tests - and the way that JUnit runs tests by default is by alphabetic name ascending.
So just name your tests in the alphabetic order that you want. Also note the test name must begin with the word test. Just watch out for numbers
test12 will run before test2
so:
testA_MyFirstTest testC_ThirdTest testB_ATestThatRunsSecond