appium入门基础知识

时间:2021-07-02 14:45:38

1.概念区分:

1)IOS-UIAutomation:随着iOS4.0的发布,苹果公司同时发布了一个名为UIAutomation的测试框架,它可以用来在真实设备和iPhone模拟器上执行自动化测试

学习网址:http://www.51testing.com/html/54/n-843354.html

       http://www.2cto.com/kf/201212/176666.html

2)Android-UiAutomator:Google在sdk4.0以后提供了一个自动化解决方案uiautomator:

  优点:可以跨应用了;这可是亲生的;

  缺点:必须sdk4.0以上版本;要想实现的好,最好有开发配合;java项目编译为jar后需要push到手机才能运行,也就是说必须打印日志暴力调试。

学习网址:http://www.tuicool.com/articles/ERBRVzY

       http://blog.csdn.net/chenbang110/article/details/23371597

3)Android-Selendriod:Selendroid 是一个 Android 原生应用的 UI 自动化测试框架。测试使用 Selenium 2 客户端 API 编写。Selendroid 可以在模拟器和实际设备上使用,也可以集成网格节点作为缩放和并行测试。

学习网址:http://hao.jobbole.com/selendroid/

2.appium架构

1)appium在Android4.1以上使用UiAutomator,4.1以下使用Selendroid;

2)在Android上使用instrumentation和UiAutomator两套技术;

3)在IOS上使用UIAutomation

3.Appium在Android上的架构

appium入门基础知识

4.Appium在IOS上的架构

appium入门基础知识

5.Appium启动参数:

1)通过Appium -help可以看到一些可选参数;

2)通过参数可以配置如下内容:监听IP和端口,是否使用Selendroid,配置Android和IOS相关参数,启动app;

3)默认开启4723端口接受webdriver请求,默认开启4724端口用于和Android通信;

6.Appium的加载流程:

1)调用Andorid abd完成基本的系统操作;

2)向Andriod上部署bootstrap.jar包并启动;

3)Forward Android 的端口到PC的机器上;

4)PC上监听端口接受请求,使用webdriver协议;

5)分析命令并转通过forward的端口发给bootstrap.jar包;

6)bootstrap接受请求并把命令发给UiAutomator或插桩体系;

7.Appium设计理念:

1)使用webdriver协议与用户交互;

2)Xpath抽象定位;

3)底层调用各自平台的自动化技术;

8.webdriver的Capabilities配置:

1)app:本地路径或网络下载的路径;

2)browserName,兼容Selendroid,并不使用;

3)Device:IOS Android firefoxos;

4)Version:Android API version, IOS version;

5)Launch:是否让appium自动启动app;

6)appActivity-你要从你的应用包中启动的 Android Activity 名称,它通常需要在前面添加 `.`  (如:使用`.MainActivity` 而不是 `MainActivity`)

7)appPackage-你想运行的Android应用的包名

参考网址:http://wenku.baidu.com/link?url=FbswfHp-YmkQKxrTAO61u9OVXp7aBA8TE5YN0hHSV8VkTXGTp1NkK_HbeuwFl1RJ8N3bRxRGlq3TUAq_wf06tv9wEDlUt8Fl8fhoxwD6MHa

附上appium的工作原理:http://blog.csdn.net/jack_chen3/article/details/42679545