本文已经迁移到测试教程网,后续更新会在测试教程网更新。html
下面这段介绍来自于appium的官网。linux
Appium is an open-source tool you can use to automate mobile native, mobile web, and mobile hybrid applications on iOS and Android platforms. “Mobile 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 on Android). “Mobile hybrid apps” have a native wrapper around a “webview” – a native control that enables interaction with web content. Projects like Phonegap, for example, make it easy to build apps using web technologies that are then bundled into a native wrapper – these are hybrid apps.android
Importantly, Appium is “cross-platform”: it allows you to write tests against multiple platforms (iOS, Android), using the same API. This enables a large or total amount of code reuse between iOS and Android testsuites.ios
咱们能够从上面的介绍里得到这样的一些信息:git
appium的哲学github
Appium was designed to meet mobile automation needs according to a certain philosophy. The key points of this philosophy can be stated as 4 requirements:web
- You shouldn’t have to recompile your app or modify it in any way in order to automate it.
- You shouldn’t be locked into a specific language or framework to write and run your tests.
- A mobile automation framework shouldn’t reinvent the wheel when it comes to automation APIs.
- A mobile automation framework should be open source, in spirit and practice as well as in name!
appium的设计哲学是这样的:windows
We meet requirement #2 by wrapping the vendor-provided frameworks in one API, theWebDriver 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. There are already clients written in every popular programming language. This also means that you’re free to use whatever test runner and test framework you want; the client libraries are simply HTTP clients and can be mixed into your code any way you please. In other words, Appium & WebDriver clients are not technically “test frameworks” – they are “automation libraries”. You can manage your test environment any way you like!设计模式
We meet requirement #3 in the same way: WebDriver has become the de facto standard for automating web browsers, and is a W3C Working Draft. Why do something totally different for mobile? Instead we have extended the protocol with extra API methods useful for mobile automation.api
It should be obvious that requirement #4 is a given – you’re reading this because Appium is open source.
首先,为了可以实现哲学里描述的第2条,也就是不该该让移动端自动化测试限定在某种语言和某个具体的框架;也就是说任何人均可以使用本身最熟悉最顺手的语言以及框架来作移动端自动化测试;appium选择了client-server的设计模式。只要client可以发送http请求给server,那么的话client用什么语言来实现都是能够的,这就是appium及webdriver如何作到支持多语言的;
其次,为了可以实现不要为了移动端的自动化测试而从新发明轮子,从新写一套惊天动地的api;也就是说webdriver协议里的api已经够好了,拿来改进一下就能够了;这个思想,appium扩展了webdriver的协议,没有本身从新去实现一套。这样的好处是之前的webdriver api可以直接被继承过来,之前的webdriver各类语言的binding均可以拿来就用,省去了为每种语言开发一个client的工做量;
最后appium固然是开源的,这也实现了哲学思想里的最后一点。
下一节讲介绍appium的一些基本概念。
本文版权归乙醇全部,欢迎转载,但请注明做者与出处,严禁用于任何商业用途