全面拥抱移动测试,Mobile JSON Wire Protocol Specification文档翻译
Selenium3已经宣布不支持移动化测试。对于老牌测试工具selenium来说这是以退为进,因为移动自动化测试工具的标准还在selenium团队手上。
本文轻度翻译了这个标准,看得懂的人不用翻译也能看懂,看不懂的人翻的天花乱坠也是一头雾水。
注意,这个规格是给工具的开发者定义的条条框框,对于使用者来说,只要知道哪些是必须工具必须支持的,且支持的细节是什么就可以了,其他可以不去深究。
这个标题就不翻译了
Mobile JSON Wire Protocol Specification
DRAFT草稿(注意,这是草稿,也就是说会变的)
Introduction简介
下面这段的大意是以前的JsonWireProtocol现在需要进行扩展了。因为要支持移动化了。
This specification is designed to extend the JSON Wire
Protocol (JSONWP),
a W3C working draft for web browser automation. The JSONWP has been greatly
successful for that purpose. The need for automation of native and hybrid
mobile applications can be met by the extension of the JSONWP, which already
has a proven basic automation framework (architecture, interaction model,
etc...).
最初的版本是由下面一群牛人在Mozilla的办公室里捣鼓出来的。
The initial details of this specification were worked out at a series of
meetings held in Mozilla's offices in London in August of 2013. The
participants were:
- David Burns (Mozilla) - website - twitter
- Dominik Dary (eBay) - website - twitter
- Jonathan Lipps (Sauce Labs) - website - twitter
- Jason ? (Facebook) - website - twitter
- François Reynaud (eBay) - website - twitter
- Simon Stewart (Facebook) - website - twitter
- Santiago Suarez Ordoñez (Sauce Labs) - website - twitter
Sessions 会话
跟webdriver一样,POST /session这个URI,然后server给你返回一个sessionId。
然后通过这个sessionId,你可以得寸进尺,为所欲为。
如果server没办法start session,那么返回的状态码是500。
Session通过DELETE /session/:id这个URI进行销毁,跟webdriver一样。
下面一段是关于AUT的,有兴趣自研。
Sessions work just like WebDriver: you POST to /session and receive a sessionId
as a response if the server can give you one, at which point you can send
further automation commands. If the server can't start a session, for example
if another session is running and only one session can be handled at a time,
the server must return the appropriate 500 response. Sessions are ended with
a DELETE to /session/:id as per the original WebDriver spec.
The server may but is not required to launch the AUT or a device/simulator in
the process of creating a session. It may but is not required to perform some
kind of cleaning or resetting of the AUT in order to provide a clean test
environment. It may but is not required to stop the running AUT at the session
end. It may but is not required to remove the AUT from the device or otherwise
reset the device state after the session is complete. In general, it is the
responsibility of the user to manage the test environment; it is not a part of
this specification. But a server conforming to this specification may by other
means provide that functionality as a convenience.
Desired Capabilities 不知道怎么翻,反正就是做配置的
有一些新的key了
automationName
: 用来指定测试工具,是appium
呢?还是ios-driver
或者是selendroid
platformName
: 测试平台。 e.g.,Android
,iOS
platformVersion
: 平台版本 e.g.,4.3
(for Android) or6.1
(for iOS)deviceName
: 测试设备名称,要有版本信息的。, e.g.,Nexus 4
,iPhone 4S
,iPhone Simulator
,iPad Mini
app
(可选): AUT的路径或者是uribrowserName
(可选): 浏览器,其实就是webdriver的session, e.g.,Safari
,Chrome
New desired capability keys:
automationName
: specific automation tool, e.g.,appium
,ios-driver
,selendroid
platformName
: platform to automate, e.g.,Android
,iOS
platformVersion
: platform version e.g.,4.3
(for Android) or6.1
(for iOS)deviceName
: specific device names including version information, e.g.,Nexus 4
,iPhone 4S
,iPhone Simulator
,iPad Mini
app
(optional): path or uri to AUTbrowserName
(optional): web browser to automate as a webdriver session, e.g.,Safari
,Chrome
Locator Strategies 新的定位策略,重点
非HTML平台,下面的这些策略是需要支持的。
class name
:就是个字符串,其实就是SDK里控件的类名。注意,android里要带包名的。, e.g.,UIAPickerWheel
for iOS orandroid.widget.Button
for Android- 这些应该完全匹配由基础自动化框架提供的类名(via google翻译)
accessibility id
: 就是代表元素可访问的id或者是label的字符串。, e.g., for iOS the accessibility identifier and for Android the content-descriptionxpath
: 老熟人了,不罗嗦
The following locator strategies must be supported for non-HTML-based platforms:
class name
: a string representing the UI element type for a given platform, e.g.,UIAPickerWheel
for iOS orandroid.widget.Button
for Android- These should exactly match the class names given by the underlying automation frameworks
accessibility id
: a string representing the accessibility id or label attached to a given element, e.g., for iOS the accessibility identifier and for Android the content-descriptionxpath
: a valid xpath string applied to the XML document that would be retrieved using the page source command
下面这些是可选的,也就是说想支持就支持,不想就算了
The following locator strategies may be supported, depending on the automation
platform:
id
: 字符串,代表对象的resource ID-android uiautomator
: 字符串,就是 UiAutomator的定位符 (Android only)- TODO: 具体描述一下
-ios uiautomation
: 字符串,也就是 UIAutomation 的定位符 (iOS-only)- TODO: 指出server是否需要指明其支持这些策略。
如果是用webdriver的模式或者是使用了HTML的平台,那么需要支持webdriver的定位策略。不罗嗦。
id
: a string corresponding to a resource ID-android uiautomator
: a string corresponding to a recursive element search using the UiAutomator library (Android only)- TODO: specify this
-ios uiautomation
: a string corresponding to a recursive element search using the UIAutomation library (iOS-only)- TODO: figure out whether server should report support of these strategies
If automating a mobile browser in WebDriver mode, or a platform that uses HTML
as its element hierarchy, the usual array of WebDriver commands must be
supported instead, with their usual semantics.
Page Source 页面源码,真牵强
所有的平台必须支持GET source命令。返回代表其UI层级的xml(html)。
其他的不翻了。
All platforms must respond to the GET source
command with an XML (or HTML in
the case of HTML-based platforms) document representing the UI hierarchy. The
precise structure of the document may differ from platform to platform. Schemas
that must be followed for iOS and Android automation are as follows:
TODO: get together schemas for UIAutomation (iOS), Instruments (Android), and
UiAutomator (Android).
The elements in these documents may be augmented with such attributes as, for
example, ids, in order to support internal behaviors.
Touch Gestures 触摸手势
所有平台都要支持Mozila提出的Multi-Action API(这个谁能告诉我怎么翻),在一些情况下如果无法支持,直接返回500.
All platforms must adopt the Multi-Action API pioneered by Mozilla. In some
cases it will not be possible to support the full range of gestures potentially
described by this API on a given platform. In this case, the platform should
respond with a 500 when it cannot faithfully render the requested gesture.
TODO: show what the gestures API actually looks like in terms of server
endpoints that must be supported.
Device Modes 设备模式
设备有很多的网络连接状态,为了能够精准控制,我们提供了下面的endpoints。
- GET /session/:sessionid/network_connection
- 返回 ConnectionType
- POST /session/:sessionid/network_connection
- 接受一个 ConnectionType
- 返回 ConnectionType
Remote端必须相应"networkConnectionEnabled"这个capability。
其他的自己看。
Devices have various states of network connectivity. In order to control
those states we have the following endpoints:
- GET /session/:sessionid/network_connection
- returns ConnectionType
- POST /session/:sessionid/network_connection
- accepts a ConnectionType
- returns ConnectionType
Setting the network connection in the POST returns the ConnectionType because
the device might not be capable of the network connection type requested.
The remote end MUST reply with the capability "networkConnectionEnabled"
ConnectionType - 连接类型
这里是指定了具体的值,可以不用理解。
Value (Alias) | Data | Wifi | Airplane Mode
1 (Airplane Mode) | 0 | 0 | 1
6 (All network on) | 1 | 1 | 0
4 (Data only) | 1 | 0 | 0
2 (Wifi only) | 0 | 1 | 0
0 (None) | 0 | 0 | 0
如果是飞行模式,那么就返回:
{ "name": "network_connection", "parameters": { "type": 1 } }
以后将支持更多的类型,比如3G,4G,LTE。
Is a bit mask that should be translated to an integer value when serialized.
Value (Alias) | Data | Wifi | Airplane Mode
1 (Airplane Mode) | 0 | 0 | 1
6 (All network on) | 1 | 1 | 0
4 (Data only) | 1 | 0 | 0
2 (Wifi only) | 0 | 1 | 0
0 (None) | 0 | 0 | 0
Example payload for setting "Airplane Mode":
{ "name": "network_connection", "parameters": { "type": 1 } }
Data is the upper bits since in the future we may want to support setting
certain types of Data the device is capable of. For example 3G, 4G, LTE.
Other Device Features
Mobile devices have a variety of sensors and input methods. These are automated
as follows:
- The virtual keyboard: use sendKeys
- acceleromator: TODO @mdas is working on this
- geolocation: use regular webdriver endpoints
- rotation (different from orientation): TODO
- battery level: not in spec, perhaps exposed via executeScript
- network speed: not in spec, perhaps exposed via executeScript
WebViews and Other Contexts
One common feature of mobile platforms is the ability to embed a chromeless
webbrowser inside of a 'native' application. These are called 'webviews', and,
if possible, a server for a given platform should implement support for
automating the webview using the full, regular, WebDriver API.
This creates a situation where there are two potential contexts for automation
in a given AUT: the native layer and the webview layer. If providing webview
support, the server must have the following endpoints:
- GET /session/:sessionid/contexts
- returns an array of strings representing available contexts, e.g. 'WEBVIEW', or 'NATIVE'
- GET /session/:sessionid/context
- returns one of:
- a string representing the current context
null
, representing the default context ("no context")
- POST /session/:sessionid/context
- accepts one of:
- a string representing an available context
null
, signifying a return to the default context
The first endpoint must return a possibly-empty array of strings. Each string
must be the arbitrary name of an available context, e.g., one of possibly
multiple webviews. The second must interpret the body of the request as the
name of an available context. If that context is not found, a NoSuchContext
error must be returned. If the context is available, the server must switch
automation to that context, such that all subsequent commands are taken to
apply to that context. If the body of the POST is null
, the server must
return to the original context.
If a server receives a request at an endpoint which is valid in some context
but not the currently active context (for example if a user callsdriver.get()
in a native context instead of a webview context), the server
must respond with an InvalidContentException.
Waiting for Conditions
The server must respond to the management commands for implicit wait timeouts,
such that when a user sets an implicit wait timeout and tries to find an
element(s), the server keeps trying to find the element(s) until that timeout
expires, rather than responding with the first failure to find the element(s).
TODO: figure out what the serversidewait implementation will be and talk about
it.
Hide details
Change log
2a302804fc1d by Luke Inman-Semerau linman-s...@salesforce.com on May 5, 2014 Diff
using "network_connectivity" enpoint
instead of toggling just airplane mode
passing a 'bitmask' for the types of
network connectivity desired
Go to:
Double click a line to add a comment
Older revisions
7a8d40f61557 by Jonathan Lipps <jlipps> on Apr 2, 2014 Diff
ba61c96e26c8 by Jonathan Lipps <jlipps> on Mar 27, 2014 Diff
5432d87357e0 by Jonathan Lipps <jlipps> on Feb 25, 2014 Diff
All revisions of this file
File info
Size: 9179 bytes, 198 lines
View raw file
全面拥抱移动测试,Mobile JSON Wire Protocol Specification文档翻译的更多相关文章
- Xml,Json,Hessian,Protocol Buffers序列化对比
简介 这篇博客主要对Xml,Json,Hessian,Protocol Buffers的序列化和反序列化性能进行对比,Xml和Json的基本概念就不说了. Hessian:Hessian是一个轻量级的 ...
- soapUI 使用soapUI测试http+json协议接口简介
使用soapUI测试http+json协议接口简介 by:授客 QQ:1033553122 SoapUI-Pro-x64-5.1.2_576025(含破解文件),软件下载地址: http://pan. ...
- 数据库 alert.log 日志中出现 "[Oracle][ODBC SQL Server Wire Protocol driver][SQL Server] 'RECOVER'"报错信息
现象描述: (1).数据库通过调用透明网络实现分布式事务,但透明网关停用后,失败的分布式事务并未清理. (2).数据库 alert 日志 Thu Sep 06 06:53:00 2018 Errors ...
- [译] QUIC Wire Layout Specification - Introduction & Overview | QUIC协议标准中文翻译(1) 简介和概述
本文同步发布于: https://www.pengrl.com/p/33330/ ,转载请注明出处,谢谢. 目录 Introduction | 简介 Conventions and Definitio ...
- Telnet Protocol Specification
Network Working Group J. Postel Request for Comments: 854 J. Reynolds ISI Obsoletes: NIC 18639 May 1 ...
- [译] QUIC Wire Layout Specification - Frame Types and Formats | QUIC协议标准中文翻译(4) 帧类型和格式
欢迎访问我的个人网站获取更好的阅读排版体验: [译] QUIC Wire Layout Specification - Frame Types and Formats | QUIC协议标准中文翻译(4 ...
- linux服务器无telnet等测试工具,测试http+json服务连通性
1. 问题描述: 1.公司内部服务器需要通过http接口方式访问另一公司内部接口服务器. 2.申请信息安全开通访问权限,但是只能开通到服务器+端口号,例如:192.168.1:8080,无ping权限 ...
- postman测试带有json数据格式的字段
测试六个字段 普通字段: ModelCode 普通字段: MmodelCode 普通字段: ModelTagKey 普通字段: ModelTagValue 普通字段: ModelTagType jso ...
- 使用JMeter进行一次简单的带json数据的post请求测试,json可配置参数
配置: 1.新建一个线程组: 然后设置线程数.运行时间.重复次数. 2.新建Http请求: 设置服务器域名,路径,方法,编码格式,数据内容. 可以在函数助手中,编辑所需要的变量,比如本例中的随机生成电 ...
随机推荐
- Android 关于 ActionBarSherlock 的使用
原文地址 本文内容 使用 主题化 ActionBarSherlock 演示项目 本文 ActionBarSherlock 简单演示 最近一个星期被 actionsherlock 搞得很不爽(光去足疗店 ...
- 详解使用DockerHub官方的mysql镜像生成容器
详解使用DockerHub官方的mysql镜像生成容器 收藏 yope 发表于 10个月前 阅读 1506 收藏 32 点赞 1 评论 0 腾讯云·云上实验室:开发者零门槛,免费使用真机在线实验!&g ...
- 通过wlst工具创建weblogic11g域单节点包括服务与被管服务
1:创建域(1)节点一执行 export MV_HOME=/home/wzh/Oracle/Middleware export WL_HOME=$MV_HOME/wlserver_10. export ...
- [转]double与BigDecimal
转自:http://superivan.iteye.com/blog/963628 [1] 精确的浮点运算: 在Java里面,有时候为了保证数值的准确性需要精确的数据,先提供一个例子就可以发现问题了: ...
- 不能设置sublime text作为默认打开程序
删除 HKEY_CURRENT_USER\Software\Classes\Applications下的Sublime_Text.exe项.你就发现可以设置为默认打开方式了
- Eclipse远程连接Hadoop
Windows下面调试程序比在Linux下面调试方便一些,于是用Windows下的Eclipse远程连接Hadoop. 1. 下载相应版本的hadoop-eclipse-plugin插件,复制到ecl ...
- MySQL事物系列:2:事物的实现
1:事物的隔离性由锁来实现.事物的持久性和事物的原子性通过redo log来实现.事物的一致性通过undo log来实现. redo log恢复提交事物修改的页操作 undo log回滚到行记录某个特 ...
- Mysql Left Join Where On
select t1.id,t2.idfrom t1left join t2 on t1.id = t2.id and t1.id>1 and t2.id<>3在mysql的left ...
- Linux下使用logrotate实现日志切换
运维过程中经常会发现一些 C 程序,每天会生产这样的日志: /home/admin/app_name/logs/access_log 那么天长地久,如果这个程序不会自动去轮转这个日志,那么这个日志文件 ...
- Linux主流架构运维工作简单剖析
转载:http://wgkgood.blog.51cto.com/1192594/1586259 随着IT运维的不断发展,尤其的Linux的飞速发展,越来越多的企业开始使用Linux操作系统平台,例如 ...