appium(1)-about appium
about appium
Introduction to Appium
Appium is an open-source tool for automating native, mobile web, and hybrid applications on iOS and Android platforms.//测试移动端应用,包括安卓和苹果平台的原生、移动web、混合应用。
- Native apps are those written using the iOS or Android SDKs.
- Mobile web apps are web apps accessed using a mobile browser (Appium supports Safari on iOS and Chrome or the built-in ‘Browser’ app on Android).
- Hybrid apps have a wrapper around a “webview” – a native control that enables interaction with web content.
Importantly, Appium is “cross-platform”: it allows you to write tests against multiple platforms (iOS, Android), using the same API. This enables code reuse between iOS and Android testsuites.//测试代码可以在安卓和苹果两个平台复用。
We use vendor-provided automation frameworks under the hood.That way, we don’t need to compile in any Appium-specific or third-party code or frameworks to your app.The vendor-provided frameworks we use are://使用系统提供的测试接口,iOS的UIAutomation和Android的UiAutomator。
- iOS 9.3 and below: Apple’s UIAutomation//appium1.5及其以前版本支持
- iOS 9.3 and up : Apple's XCUITest//appium1.6及其以后版本支持。
- Android 4.2+: Google’s UiAutomator
- Android 2.3+: Google’s Instrumentation. (Instrumentation support is provided by bundling a separate project, Selendroid)
We wrap the vendor-provided frameworks in one API, the WebDriver API. WebDriver (aka “Selenium WebDriver”) specifies a client-server protocol (known as the JSON Wire Protocol). Given this client-server architecture, a client written in any language can be used to send the appropriate HTTP requests to the server.//使用WebDriver(webdriver是web端测试时涉及到的一个协议,把客户端代码翻译成浏览器可以识别的代码)。
Appium Concepts
Client/Server Architecture
Appium is at its heart a webserver that exposes a REST API. It receives
connections from a client, listens for commands, executes those commands on a
mobile device, and responds with an HTTP response representing the result of
the command execution. The fact that we have a client/server architecture
opens up a lot of possibilities: we can write our test code in any language
that has a http client API, but it is easier to use one of the Appium client
libraries. We can put the server on a different machine than our
tests are running on. We can write test code and rely on a cloud service
like Sauce Labs to receive and interpret the commands.//cs结构,客户端和服务器端的交互遵循REST API风格,由此带来两个好处,一是客户端可以使用任意编程语言,二是服务器端与客户端可以不在一个机器上。
Session
Automation is always performed in the context of a session. Clients initiate
a session with a server in ways specific to each library,
but they all end up sending a POST /session
request to the server,
with a JSON object called the ‘desired capabilities’ object. At this point
the server will start up the automation session and respond with a session ID
which is used for sending further commands.//自动化的所有操作都是在一个session基础上完成的。
Desired Capabilities
Desired capabilities are a set of keys and values (i.e.,
a map or hash) sent to the Appium server to tell the server what kind of
automation session we’re interested in starting up. There are also various
capabilities which can modify the behavior of the server during automation.
For example, we might set the platformName
capability to iOS
to tell
Appium that we want an iOS session, rather than an Android one. Or we might
set the safariAllowPopups
capability to true
in order to ensure that,
during a Safari automation session, we’re allowed to use JavaScript to open
up new windows. See the capabilities doc for the complete list of capabilities available for Appium.//一些键值对,可以决定session的类型,比如是建立一个iOS session,还是一个Android session。
Appium Server
Appium is a server written in Node.js. It can be built and installed from source or installed directly from NPM:
$ npm install -g appium
$ appium //用Node.js语言写成的一个服务端。
Appium Clients
There are client libraries (in Java, Ruby, Python, PHP, JavaScript, and C#)
which support Appium’s extensions to the WebDriver protocol.//支持多种语言。
Language/Framework | Github Repo and Installation Instructions |
---|---|
Ruby | https://github.com/appium/ruby_lib |
Python | https://github.com/appium/python-client |
Java | https://github.com/appium/java-client |
JavaScript (Node.js) | https://github.com/admc/wd |
Objective C | https://github.com/appium/selenium-objective-c |
PHP | https://github.com/appium/php-client |
C# (.NET) | https://github.com/appium/appium-dotnet-driver |
RobotFramework | https://github.com/jollychang/robotframework-appiumlibrary |
Appium Platform Support
iOS Requirements
- Mac OS X 10.10 or higher, 10.11.1 recommended
- XCode >= 6.0, 7.1.1 recommended
- Apple Developer Tools (iPhone simulator SDK, command line tools)
- Ensure you read our documentation on setting yourself up for iOS testing!
iOS Support
See Running on OS X: iOS for iOS requirements and setup instructions.
- Versions: 7.1, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1 and 9.2
- Devices: iPhone Simulator, iPad Simulator, and real iPhones and iPads
- Native app support: Yes, with debug version of .app (simulator), or correctly-signed .ipa (real devices). Underlying support is provided by Apple’s UIAutomation framework.
- Mobile web support: Yes, via automation of mobile Safari. For real devices, ios-webkit-remote-debugger is required, and automation of native aspects of the Safari interface is not possible. See the mobile web doc for instructions.
- Hybrid support: Yes. For real devices, ios-webkit-remote-debugger is required. See the hybrid doc for instructions.
- Support for automating multiple apps in one session: No
- Support for automating multiple devices simultaneously: No
- Support for automating vendor-provided or third-party apps: Only vendor-provided apps (Preferences, Maps, etc…), and only on the simulator
- Support for automating custom, non-standard UI controls: Minimal. You need to set accessibility information on the control which enables some basic automation.
Android Requirements
- Android SDK API >= 17 (Additional features require 18/19)
- Appium supports Android on OS X, Linux and Windows. Make sure you follow the directions for setting up your environment properly for testing on different OSes:
Android Support
See Running on OS X: Android, Running on Windows, or Running on Linux for Android requirements and setup instructions.
- Versions: 2.3 and up//支持安卓版本2.3及其以上。
- Versions 2.3 through 4.2 are supported via Appium’s bundled version of Selendroid, which utilizes Instrumentation. Selendroid has a different set of commands than the default Appium (though this is rapidly being minimized) and a different support profile. To access this automation backend, use the
automationName
capability with the valueSelendroid
. - Versions 4.2 and up are supported via Appium’s own UiAutomator libraries. This is the default automation backend.
- Versions 2.3 through 4.2 are supported via Appium’s bundled version of Selendroid, which utilizes Instrumentation. Selendroid has a different set of commands than the default Appium (though this is rapidly being minimized) and a different support profile. To access this automation backend, use the
- Devices: Android emulators and real Android devices//支持仿真机和实体机。
- Native app support: Yes//支持原生应用、移动端web应用和混合应用。
- Mobile web support: Yes (but not when using Selendroid backend). Automation is effected using a bundled Chromedriver server as a proxy. With 4.2 and 4.3, automation works on official Chrome browser or Chromium only. With 4.4+, automation also works on the built-in “Browser” app. Chrome/Chromium/Browser must already be installed on the device under test. See the mobile web doc for instructions.
- Hybrid support: Yes. See the hybrid doc for instructions.
- With default Appium automation backend: versions 4.4 and up
- With Selendroid automation backend: versions 2.3 and up
- Support for automating multiple apps in one session: Yes (but not when using the Selendroid backend)//在一个session可以操作多个应用。
- Support for automating multiple devices simultaneously: Yes, though Appium must be started using different ports for the server parameters
--port
,--bootstrap-port
(or--selendroid-port
) and/or--chromedriver-port
. See the server args doc for more information on these parameters.//通过配置不同端口号来操作多台设备。 - Support for automating vendor-provided or third-party apps: Yes (but not when using the Selendroid backend)
- Support for automating custom, non-standard UI controls: No
Difference between device and emulator
Appium on real Android devices
Hooray! There’s nothing extra to know about testing real Android devices: it works exactly the same as testing on emulators. Make sure that your device can connect to ADB and has Developer Mode enabled. For testing Chrome on a real device, you’re responsible for ensuring that Chrome of an appropriate version is installed.//测试时,真机和模拟器没啥不一样
Appium on real iOS devices
Appium has support for real device testing.//测试时,真机和模拟器太多不一样
To get started on a real device, you will need the following:
- An Apple Developer ID and a valid Developer Account with a configured distribution certificate and provisioning profile.
- An iPad or iPhone. Make sure this has been set up for development in Xcode. See this article for more information.
- A signed
.ipa
file of your app, or the source code to build one. - A Mac with Xcode and the Xcode Command Line Developer Tools.
Provisioning Profile:A valid iOS Development Distribution Certificate and Provisioning Profile are necessary to test on a real device. Your app will also need to be signed. You can find information about this in the Apple documentation.
Appium will attempt to install your app using Fruitstrap, but it is often easier to pre-install your app using Xcode to ensure there are no problems (see the iOS deploy doc for more information).
Testing using Xcode 8 (including iOS 10) with XCUITest:This functionality currently depends on logging based on idevicesyslog
, and port forwarding based on iProxy
, both of which are part of libimobiledevice
. Install it with Homebrew,
brew install libimobiledevice
Alternatively, logging can be done using deviceconsole
, which is available here. To choose between them, use the desired capability realDeviceLogger
, passing in the path to the logging program.
Running your tests with Appium:Once your device and app are configured, you can run tests on that device by passing the -U
or --udid
flag to the server or the udid
desired capability, and the bundle ID (if the app is installed on the device) or the path to the .ipa
or .apk
file via the --app
flag or the app
desired capability.
Server Arguments:For example, if you are prelaunching your app and wish for Appium to force use a specific UDID, then you may use the below command:
appium -U <udid> --app <path or bundle>
This will start Appium and have Appium use the device to test the app.
Refer to the Appium server arguments page for more detail on the arguments that you can use.
Desired Capabilities:You can launch the app on a device by including the following desired capabilities in your tests:
app
udid
Refer to the Appium server capabilities page for more detail on the capabilities that you can use.
Troubleshooting ideas
- Make sure UDID is correct by checking it in Xcode Organizer or iTunes. It is a long string (20+ chars).
- Make sure that you can run your tests against the Simulator.
- Double check that you can invoke your automation from Instruments.
- Make sure Instruments is not already running.
- Make sure UI Automation is enabled on your device. Settings -> Developer -> Enable UI Automation
appium(1)-about appium的更多相关文章
- Windows&Appium&Python自动化测试-Appium安装
一.安装node.js 官方下载地址为:https://nodejs.org/en/download 傻瓜式安装即可,安装完成后,CMD中运行node -v查看版本号 输入npm 出现如上图信息,表示 ...
- appium远程调用appium server
如何通过本地的代码,调用远程的server呢? 例如:我有两台电脑A(192.168.112.10)和B(192.168.112.11),那我怎么能在A执行本地脚本,但是使用B上的server呢? ...
- Appium自动化测试之Appium的安装与配置
Appium自动化测试- Appium环境的安装与配置Appium中文文档: https://github.com/appium/appium/tree/master/docs/cn Appium的安 ...
- 【Appium自学】Appium [安装包] Appium 官方文档(转发)
转发地址:https://blog.csdn.net/panyu881024/article/details/80149190 Appium国内下载地址 : http://pan.baidu.com/ ...
- Appium学习——安装appium Server
安装appium Server 下载地址:百度网盘的下载链接:https://pan.baidu.com/s/1pKMwdfX 下载后, AppiumForWindows.zip 进行解压,点击 ap ...
- Appium 自动化测试(8) -- Appium Python client -- API
最好的学习方法,就是看源码! 在 \appium\webdriver\webdriver.py ,新增了两个封装好定位安卓元素的方法,如 find_element_by_accessibility ...
- Appium 自动化测试(3)--Appium框架与流程介绍
Appium介绍 Appium是一个移动端的自动化框架,可用于测试原生应用,移动网页应用和混合型应用,且是跨平台的.可用于IOS和Android以及firefox的操作系统.原生的应用是指用andro ...
- Appium 自动化测试(7) -- Appium 服务器初始化参数设置
Desired Capabilities Desired capabilities 是一些发送给 Appium 服务器的键值对集合 (比如 map 或 hash),告诉服务器我们想要启动什么类型的自动 ...
- appium+python自动化☞appium python api大全
整理了一些常用的appium python api,供学习使用...
随机推荐
- hdu 5443(线段树水)
The Water Problem Time Limit: 1500/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Othe ...
- 用jQuery File Upload实现简单的文件上传
FORM中的代码: {# file_path #} <div class="form-group"> <label class="control-lab ...
- 使用vue-element-admin框架开发时遇到的跨域问题
之前 使用js和jquery开发时也碰到过接口请求时的跨域问题, 但是在使用vue-element-admin开发也碰到这个问题,而且不能使用之前的方法解决,查过不少资料,找到一个很好的方法解决了这个 ...
- Java 经典笔试题
这些题目对我的笔试帮助很大,有需要的朋友都可以来看看,在笔试中能遇到的题目基本上下面都会出现,虽然形式不同,当考察的基本的知识点还是相同的. 在分析中肯定有不足和谬误的地方还请大虾们能够给予及时的纠正 ...
- redis基本类型和操作
基本类型:string hash list set sorted set 添加String 类型(最基本的key,value形式) set str1 s1 获取value get str1 添加has ...
- arcgis andriod Edit features
来自:https://developers.arcgis.com/android/guide/edit-features.htm#ESRI_SECTION1_56C60DB71AF941E98668A ...
- win7阻止iis开机启动
https://zhidao.baidu.com/question/111234812.html 1.在"开始/运行/" 输入"services.msc" 启动 ...
- dubbo开发者指南
开发者指南 参与 流程 任务 版本管理 源码构建 框架设计 整体设计 模块分包 依赖关系 调用链 暴露服务时序 引用服务时序 领域模型 基本原则 扩展点加载 扩展点配置 扩展点自动包装 扩展点自动装配 ...
- 梦入IBM之java基础-网络编程
如今我们来谈谈最后的内容:网络编程: 1):TCP中是线程与线程进行通讯!内部的执行机制是这种:先有一个线程去监听某个port.然后假设有Socket连接上来了以后,server会生成一个Socket ...
- 【Scala类型系统】自身类型(self type)引用
定义 特质能够要求混入它的类扩展自还有一个类型,可是当使用自身类型(self type)的声明来定义特质时(this: ClassName =>).这种特质仅仅能被混入给定类型的子类其中. 如果 ...