美文网首页Android
Junit test execute with specific

Junit test execute with specific

作者: JaedenKil | 来源:发表于2018-04-25 16:47 被阅读1次

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

相关文章

网友评论

    本文标题:Junit test execute with specific

    本文链接:https://www.haomeiwen.com/subject/vjyylftx.html