Test Automation Through Appium
Introduction
With the ever increasing use of Mobile technology, testing also needs to keep up with the related hardware and software complexities in terms of both volume and variety. At this point, test automation seems to be the only solution available to manage the situation. Appium is one such open source test automation tool used for native and hybrid applications on Android and iOS platforms. Appium is also a cross browser test automation tool that can be used for writing test for multiple platforms using the same API. This also facilitates code reuse.
Appium has three main components – The Appium Server, Inspector and Doctor.
- Appium is basically a webserver that works through REST API. This opens up a lot of possibilities like test cases can be written in any language that has an HTTP client API.
- Here automation is performed mainly in sessions. Clients initiate a session with the server and send a JSON object and the server starts up an automation session that responds with a session ID that for sending further commands.
- A set of keys and values are used for notifying the Appium server about the type of automation session required to be set up. Defining various values can can change the server behavior as per the requirements.
- The Appium server is written in node.js. The capabilities of the server can be modified as per the test requirements.
- Appium client libraries are available in Java, Ruby, PHP, Python, JavaScript and C #.
- The Appium GUI wrappers are available with all the artifacts required to run the Appium server.
In iOS, Appium proxies the commands to UIAutomation script running in the Mac Instruments environment. Instruments is an app provided by Apple which has an automation component. Here, commands can be written in JavaScript using UIAutomation APIs to interact with the App UI. Appium utilizes these libraries to automate iOS Apps.
In the iOS command life cycle, the web driver picks the command from the code and sends it in the form of JSON through an HTTP request to the Appium server which then sends the command to the Instruments command server. The command server waits for the Instruments command client to receive it and execute it in bootstrap.js. Once the command is executed, the command client sends the message back to the Appium server which logs all the information related to the command.
The same principle is applied in Android as well. Here, Appium proxies command to a UIAutomator test case running on the device. UIAutomator is Android's native UI automation framework. It runs jUnit test cases directly into the device through the command line.
Here, bootstrap.jar represents the test case when it is compiled in java. Here, the TCP server resides in the device and the client is in the Appium process.
Conclusion
With continuous advancements in mobile technology, high performance applications are required to be designed and developed as fast as possible. Testing them is even more important before launching them, especially for those apps which perform critical functions. Test automation helps to ensure high performance of an application in a short period. Appium promises efficient bug free and quality rich applications saving a lot of time, labor and cost of the project.