当前位置: 首页 > 工具软件 > Athrun > 使用案例 >

Athrun框架(只有apk包)

司徒锐进
2023-12-01

学了淘宝的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/archive/2013/01/15/2861877.html

 类似资料: