appium(四)交互分析

来源:互联网 发布:半自动咖啡机 知乎 编辑:程序博客网 时间:2024/05/18 02:55

一、简介

英文官网:appium官网

Appium跨平台、开源的自动化测试工具,支持IOS和Android平台的原生的、基于移动浏览器、混合的应用。

原生应用:仅使用iOS和安卓标准SDK编写的应用

基于移动浏览器的应用:用移动平台的浏览器访问的应用(Appium支持IOS上的Safari和安卓上的Chrome或内嵌的“浏览器”应用)

混合应用:把基于一个WebView实现的所有功能包装成一个应用的应用,WebView是一个可以和网页各种元素交互的原生控件(译者注:因为所有的移动平台都会有浏览器,所以基于浏览器封装起来的应用就可以轻易做到跨平台了)。Phonegap这些项目可以很方便的把那些基于web技术实现的功能打封装成一个混合应用。

跨平台的意义:点击打开链接

appium不是一个新开发的框架,只是将现已有的框架进行集成,使其使用的范围更。

Appium的理念:

Appium was designed to meet mobile automation needsaccording to a philosophy outlined by the following four tenets:

  1. You shouldn’t have to recompile your app or modify it in any way in order to automate it.
  2. You shouldn’t be locked into a specific language or framework to write and run your tests.
  3. A mobile automation framework shouldn’t reinvent the wheel when it comes to automation APIs.
  4. A mobile automation framework should be open source, in spirit and practice as well as in name!
二、设计:

iOS的UIAutomation和Android的Instrumentation及UIAutomator采用的这些工具都是标准的平台供应商提供的框架,所以在使用的时候就不需要将任何的框架编译到app中去。

三、架构:

客户端/服务器端架构

Appium的核心是一个暴露了REST API的网络服务器。它接收客户端过来的连接,监听(客户端过来的)命令,在移动设备上运行命令,然后把代表命令运行结果的HTTP响应包发送回客户端。

四、会话:

客户端发起一个会话,发送一个包含所谓的“desired capabilities"JSON对象的Post/session的请求到服务器端。这样服务器端就会开启一个自动化会话并把会话ID发送回客户端以便往后的持续的命令传递。

五、Desired Capabilities:

Desired Capabilities是由客户端发送给Appium服务器端的用来告诉服务器去启动哪种我们想要的会话的一套键值对集合。当中也有一些键值对是用来在自动化的过程中修改服务器端的行为方式的。http://appium.io/slate/en/master/#caps.md

六、服务器:

由node.js编写,可以通过NPM进行编译和安装。

七、客户端:

There are client libraries (in Java, Ruby, Python, PHP,JavaScript, and C#) which support Appium’s extensions to the WebDriverprotocol. When using Appium, you want to use these client libraries instead ofyour regular WebDriver client

Appium.app, Appium.exe
There exist GUI wrappers around the Appiumserver that can be downloaded. These come bundled with everything required torun the Appium server, so you don’t need to worry about Node. They also comewith an Inspector, which enables you to check out the hierarchy of your app.This can come in handy when writing tests.


八、appium 在android端工作流

1、client端也就是我们 testscript是我们的webdriver测试脚本。

2、中间是起的Appium的服务,Appium在服务端起了一个Server(4723端口),跟seleniumWebdriver测试框架类似, Appium⽀持标准的WebDriverJSONWireProtocol。在这里提供它提供了一套REST的接口,Appium Server接收web driver client标准rest请求,解析请求内容,调⽤用对应的框架响应操作。

3、appium server会把请求转发给中间件Bootstrap.jar ,它是用java写的,安装在手机上.Bootstrap监听4724端口并接收appium 的命令,最终通过调⽤用UiAutomator的命令来

实现。

4、最后Bootstrap将执行的结果返回给appiumserver。

5、appium server再将结果返回给appium client。



0 0
原创粉丝点击