Appium is a mobile app automation testing tool. It can be used to test apps run in iOS and android platform. It can test both native, web and hybrid mobile applications. It is open source.
Mobile native apps are those that are written using iOS or Android SDK. The so-called “mobile web application” refers to applications accessed using a mobile browser (Appium supports Safari in iOS and Chrome in Android).
And “hybrid application” refers to the native code that encapsulates a web view — use native code to interact with web page content. This can help developers develop applications using web technology, and then encapsulate them in native code.
1. The Concept Of Appium
To meet mobile automation requirements, Appium follows a philosophy that focuses on the following four requirements:
- Don’t have to recompile or modify application for automation.
- Don’t have to be limited to a certain language or framework to write and run test scripts.
- A mobile automation framework should not duplicate the wheel of the interface. (mobile automation interfaces should be unified).
- Open source, both mentally and nominally.
2. Appium Design
So how does the Appium architecture implement this philosophy? To meet the first point, the real work engine of Appium is actually a third-party automation framework. That way, we don’t need to embed Appium related or third-party code in your application. This means that the tested app is not different from the final release. Appium use following third party frameworks:
- iOS: apple’s UIAutomation.
- Android 2.3+: Google’s Instrumentation. (Instrumentation is supported by a separate project Selendroid).
- Android 4.2+: Google’s UiAutomator.
- Windows: Microsoft’s WinAppDriver.
To meet the second point, we encapsulate these third-party frameworks into a set of apis, the WebDriver API.WebDriver (aka “Selenium WebDriver”) specifies the client to the server-side protocol.
The client library is simply an HTTP client that can sneak into your code in any way you like. In other words, the Appium and WebDriver clients are not technically “test frameworks” but “automation libraries”. You can use these automation libraries in your test environment!
In fact, WebDriver has become the standard for web browser automation. Why should we do something completely different for mobile? So we’ve extended the WebDriver protocol and added mobile automation-related API methods on the original basis.
3. Appium Architecture
- C/S Architecture.
The core of Appium is a web server that provides a set of REST interfaces. It receives the client’s connection, listens to the command, then executes the commands on the mobile device, and then returns the execution results to client in HTTP response.In fact, this client/server architecture gives you a lot of possibilities: you can use any language that implements this client to write test code. You can put the server side in different machines. You can only write test code, and then use cloud services like Sauce Labs to execute commands.
The automation process always run in one session. Client initializes a seesion to interact with server, different languages have different ways of session implementation, but eventually they all send a POST request to the server, the request contains a JSON object, which is called ” desired capabilities “. Then the server starts an automation session and returns a session ID to client user for subsequent commands.
- Desired Capabilities.
- Appium Server.
Appium server is written in node.js. We can compile from source code or install directly from NPM.
- Appium Client.
- Appium.app, Appium.exe
There are also a GUI encapsulated Appium server download that encapsulates all the dependencies need to run Appium server. Use this tool, you do not need to worry about how to install node.js. It also includes an Inspector tool that can help you check the application’s interface hierarchy, which is more convenient when writing test cases.