Normally Junit tests run with random order.
We can make the tests run with a specific order:
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
@RunWith(AndroidJUnit4.class)
public class DummyTest {
private static final String TAG = DummyTest.class.getSimpleName();
@Test
public void test01() throws Exception {
Log.v(TAG, "Test 01");
}
@Test
public void test02() throws Exception {
Log.v(TAG, "Test 02");
}
@Test
public void test03() throws Exception {
Log.v(TAG, "Test 03");
}
}
Output:
V/DummyTest: Test 01
V/DummyTest: Test 02
V/DummyTest: Test 03