Loading

Mobile Testing - Appium Framework


In this day and age, wherever you look, you will find an individual with a mobile phone, smartphone, or a tablet. These mobile phones provide its users a great deal of convenience and they are extremely easy to carry and use. From ordering and purchasing things online, to basic calling, texting, video chatting, socializing, to several other activities, we are dependent on these devices for various reasons. All of these mobile devices, though have different operating systems, they cater to client and customer’s various requirements and make their day to day activities hassle free and convenient.

Moreover, smartphones, tablets and other devices consist of numerous applications, which further simplifies our life and improve our daily activities. But to maintain this convenience for users and to keep the popularity of these devices, it becomes tremendously necessary for developers and testers to ensure their functionality, effectiveness, scalability, performance, and more. All these qualities of a mobile application is only validated through proper testing during, which is executed by a tester at every stage of application development. Furthermore, to achieve the goal of developing a perfect and defect free application, testers use a variety of testing frameworks, which further verify that the application is safe can is ready for the use of the end users. Hence, here is a discussion on one such testing framework, which is commonly used by testers all across the globe.

Defining Appium:

Appium is an open source tool for automating native, mobile web and hybrid applications on iOS and Android. It is a freely distributed mobile application with UI testing framework. Appium offers cross platform application testing, i.e., single API works for both iOS and Android platform test scripts. Appium supports all languages that have Selenium client libraries like Java, Objective-C, JavaScript with node.js, PHP, Ruby, Python, C#, and more. In its architecture, Appium is an HTTP server written in Node.js that creates and handles multiple WebDriver sessions. Appium starts tests on the device and listens for commands from the main Appium server. It is almost the same as the Selenium server that gets HTTP requests from Selenium client libraries. Additionally, the importance of Appium is immense as it integrates with continuous integration servers to ensure better results and drives GUI related widgets and controls, allowing same scripts to run for different software versions of various applications. Moreover, just like different browsers respond differently to web design, similarly, mobile operating systems render applications differently. To help with this situation, Appium is used by software developers and testers all around the world. It is one such framework of testing that allows native, hybrid and web applications testing and supports test on physical as well as on emulator and simulator both.

  • Native applications: These applications are written using the operating system’s software development kit. Native applications are designed for a specific operating system. Moreover, these are the applications that are found of the devices and are accessed through icons present on their home screen. The native applications are installed through an application store, such as Google Play or Apple’s App Store. They are developed specially for one platform and can take full advantage of the all the features of the device. Also, these applications use the devices notification system and can easily work offline.
  • Mobile Web Application: A web application, on the other hand, is basically a website optimized for functional use as an application. These web applications are a version of the same website accessed by a browser on a desktop but made responsive so users can access them on their mobile browsers such as Safari on an iOS or Google Chrome on an Android. Web apps primarily are made using HTML, CSS, and Javascript, unlike native apps. Mobile apps require developers to optimize for responsive design across different devices, not only the separate operating systems.
  • Hybrid applications: Hybrid applications are part of native as well as mobile web applications. That is, like the native applications these are also found in the app store and can take advantage of all the available features of the devices. Also, like the web applications these apps rely on HTML being rendered in a browser, with the caveat that the browser is embedded within the application. Hybrid applications get their name from the fact that, these applications are mostly built using HTML, CSS, Javascript, which are the same languages used to build web applications, though some native code is also used to build its structure. These applications are also popular because they allow cross platform development and thus significantly reduce development cost.

Concepts for Appium:

Concepts are the fundamental building blocks of a structure or a technique. They play a very crucial role in all aspects of cognition. Similarly, in software and application development and testing, there are several concepts that come together to create/develop a software that determine its functionality, effectiveness, quality and performance. In Appium too, developers use a variety of concepts and guidelines that are essential for building a perfectly working application. Therefore, to assist developers and testers in testing an application appropriately, here are the concepts of Appium:

  1. Client/Server 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 returns the execution results to client in HTTP response. The client/server architecture provides a lot of possibilities such as, one can use any language that implements the client to write the test code. Also, it allows one to put the server side in different machines, write test code, and then use cloud services like Sauce Labs to execute commands.
  2. Session: Automation is always performed in the context of a session. Client initiate a session with a server in ways specific to each library, but they all end up sending a post/session request to sever, with a JSON object called the ‘desired capabilities’ object. At this point the server will start up the automation with a session ID which is used for sending other commands.
  3. Desired Capabilities: These are a set of keys and values sent to the Appium server to tell the server the type of automation session is required by the client. There are also various capabilities, which can modify the behaviour of the server during the process of automation.
  4. Appium Server: In this the server is written in Node.js. It can be built and installed from the source or directly from the NPM.
  5. Appium Clients: There are libraries in Java, Ruby, Python, PHP, Javascript and C#, which support Appium’s extension to the WebDriver protocol. When using Appium, one should use these client libraries instead of the regular WebDriver client.
  6. Appium Desktop: There exist GUI wrappers around the Appium server that can be downloaded. These come bundled with everything required to run the Appium server, so you don’t need to worry about Node. They also come with an Inspector, which enables you to check out the hierarchy of your app. This can come in handy when writing tests.

Testing an Application with Appium:

To meet mobile automation requirements, Appium follows a philosophy, which supports that a mobile automation framework should not duplicate the wheel of the interface and that it should not be limited to a certain language or framework to write and run test scripts. Furthermore, it ensures that there is no requirement for the user to recompile of modify the application in any way or order to automate it. Appium is built on the idea that testing native apps should not require SDK or recompiling and that one should be able to use their preferred test practise, framework, and tools. In short, Appium is an open source project and has made design and tool decisions to encourage a vibrant contributing community. During the process of testing an application through Appium, one needs to follow a variety of steps that validate the quality as well as the performance of that application. Therefore, here are the steps involved in testing an application with the assistance of Appium:

  1. The first step in testing an application through Appium is to create a test project in the Android Studio named as “Robotium Test”. After which the tester needs to choose all the default options until they reach to the main page.
  2. In the second step, the Appium jars are added into the project. Click Project --> App --> Copy all the jars in lib. Then select the copied jars except Selenium, Java client or Junit Jar, then right click on it and click on “Add as Library”,
  3. The third step is where the tester clicks on build.gradle in the application, after which all the libraries added will be visible to the tester.
  4. At this stage of testing, the tester needs to create a Java Class.
  5. This is the last stage of testing in which the tester runs the test cases in the following manner:
    1. Click on build variant and select Unit Testing.
    2. Start the Appium Server with the specific port “4444”.
      • Download the Appium for windows.
      • Double click on the .exe and install Appium.
      • Click on the icon to up the UI.
      • Change the port if required.
      • Click the play button to stat the server.
      • Connect the device with the USB debugging on or start an emulator.
      • Right Click the test class and click on “Run”.

Advantages of Appium:

Appium is one of the most advantageous testing framework used by software engineers to determine the effectiveness and performance of a software application. With its assistance, developers can build an application that is compatible to both Android and iOS operating system and ensure that it functions as per the client’s requirements and demands. Moreover, Appium aims to automate any mobile app from any language and any test framework, with full access to back-end APIs and DBs from test code. With Appium, one can easily write test using all the aforementioned programming languages and probably more, with the assistance of Selenium Web Driver API and language specific client libraries. Other advantages of this framework are cited below:

  • It is free and mostly open source.
  • It has a very well supported and active Google group, which further helps organisations.
  • Appium is in the Selenium 3 Spec, so should be future proof.
  • The biggest advantage of Appium is that it supports iOS and Android both.
  • There is no need for the Appium user to install anything on their devices, as it does not require any code or server change.

Disadvantages of Appium:

These aforementioned advantages of Appium signify the importance as well as usefulness of this framework of testing applications. However, to ensure that the client gets the best result out of the developed applications, it is of utmost importance to understand and know the disadvantages of Appium. This not only makes the tester aware of the frameworks drawbacks, but also assist them in tacking all these drawbacks. Hence, the disadvantages of Appium are:

  • There is no support for intelligent waits.
  • On iOS, tester can only execute one test at a time per Mac.
  • Provides limited support for gestures.
  • There is limited support for Android below 4.1.

Conclusion:

With each passing day our world is getting more and more dependent on technology and its advantages. People wait in lines eagerly to purchase latest applications and gadgets, which have newer and fancier features as well as qualities. Nowadays, the mobile devices too are getting new makeovers and features, which can attract and capture the attention of the people all over the world. This demand of exceptional quality applications and devices has forced developers and programmers to perform extensive testing on the developed applications. Appium framework is one such testing methodology used by developers and testers to make application of superior quality and outstanding scalability. Moreover, it ensures that the application is compatible to various operating systems, such as iOS and Android. Additionally, Appium is an open source and cross platform tool that helps automate Mobile application testing for both Android and iOS. It supports native, mobile and hybrid applications and can use any language that Selenium WebDrivers support. Hence, with the assistance of Appium one can easily test the compatibility, scalability and performance of the developed software application and can enjoy its benefits.