Athrun框架(只有apk包)

学了淘宝的Android自动化框架Athrun后,整理了一下,分享Athrun只有apk包的自动化测试框架代码。

Athrun与Robotium相比,优势就是原生就有通过ID查找所有控件方法,一切面向对象,控件更好管理。直接上代码。

package com.xxxxxx.test1;

import org.athrun.android.framework.AthrunTestCase;
import org.athrun.android.framework.Test;

public class MainActivityTest extends AthrunTestCase {
    private static final String LOG_TAG = "MainActivityTest";

    public MainActivityTest() throws Exception {
        super("com.xxxxxx", "com.xxxxxx.xx.xxxxxxxxActivity");
        AthrunTestCase.setMaxTimeToFindView(10000);
    }
    
    @Test
    public void testWaitForActivity() throws Exception {
        
                //Case1
        findElementById("btn_1").doClick();
        Thread.sleep(3000);
        findElementById("text_1").doClick();
        Thread.sleep(3000);
        //getDevice().pressBack();
        //assertEquals(true, getDevice().waitForActivity("xxxxxxxActivity", 5000));
        

}
        
原文地址:https://www.cnblogs.com/vincentvan/p/2861877.html