Appium is a mobile app automation testing tool. It can be used to test apps run on iOS and android platforms. It can test both native, web, and hybrid mobile applications. It is open source.
1. Mobile Native Apps & Mobile Web Apps & Hybrid Application.
- 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.
2. 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 the 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.
3. 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 uses the 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.
4. 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 the client in the 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.
- Session: The automation process always runs in one session. The client initializes a session to interact with the 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 the client user for subsequent commands.
- Appium Server: The Appium server is written in node.js. We can compile from source code or install directly from NPM.
- Appium.app, Appium.exe: There is also a GUI encapsulated Appium server download that encapsulates all the dependencies need to run the 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.