appium簡明教程(1)——appium和它的哲學世界


什么是appium?

 

本文已經遷移到測試教程網,后續更新會在測試教程網更新。

下面這段介紹來自於appium的官網。

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.

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.

 

我們可以從上面的介紹里獲得這樣的一些信息:

 

  • 1,appium是開源的移動端自動化測試框架;
  • 2,appium可以測試原生的、混合的、以及移動端的web項目;
  • 3,appium可以測試ios,android應用(當然了,還有firefox os);
  • 4,appium是跨平台的,可以用在osx,windows以及linux桌面系統上;

 

appium的哲學

 

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:

  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!

 

 appium的設計哲學是這樣的:

  • 1,不需要為了自動化而且重新編譯或修改測試app;
  • 2,不應該讓移動端自動化測試限定在某種語言和某個具體的框架;也就是說任何人都可以使用自己最熟悉最順手的語言以及框架來做移動端自動化測試;
  • 3,不要為了移動端的自動化測試而重新發明輪子,重新寫一套驚天動地的api;也就是說webdriver協議里的api已經夠好了,拿來改進一下就可以了;
  • 4,移動端自動化測試應該是開源的;

appium的技術架構

 

appium的設計思想

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.

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的一些基本概念。

 本文版權歸乙醇所有,歡迎轉載,但請注明作者與出處,嚴禁用於任何商業用途

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM