简体   繁体   中英

android uiautomator how to manage test method order

I am in the process of impelementing unit test via uiautomator. Right now i am facing the issue that i couldn`t manage test method order. Please help me how can i manage test methods sequence of running. It is not working by sequence of methods. Thanks in advance.

@Test
public void firstTest() {
    Log.i("Tage", "simpleTest");
    assertEquals(1, 1);
}

@Test
public void secondTest() {
    Log.i("Tage", "simpleTest");
    assertEquals(false, false);
}

@Test
public void thirdTest() {
    Log.i("Tage", "simpleTest");
    assertEquals(true, true);
}

While I would not recommend having tests that depend on the execution order as they should be independent of each other, you can annotate you class with

@FixMethodOrder(MethodSorters.NAME_ASCENDING)

you can also use DEFAULT and JVM as sorters.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM