DETAILED READ SECTION

Appium Interview Questions & Answers


Question: Explain What Is Appium?

Answer :

Appium is a freely distributed open source mobile application UI testing framework.


Question: Which Language Should I Use To Write My Tests?

Answer :

This is probably the best thing about Appium: you can write your tests in any language. Since Appium is nothing more than an HTTP server, a test which needs to be interfaced with Appium can simply use HTTP libraries to create HTTP sessions. You just need to know the Selenium protocol in order to compose the right commands and that's it!


However, as you can imagine, there are already some libraries doing this for the most common languages and development frameworks out there: C#, [dotnet], [java], Ruby, [python] and Javascript are just few examples; and they all are open source projects.


Question: What Type Of Tests Are Suitable and Not Suitable For Appium?

Answer :

When it comes to testing, especially webview-based apps, there are a lot of scenarios that can be tested also depending on the feature coverage you want to ensure. Appium is pretty handy for testing scenarios that users will go through when using your app.


But if you need to test more than UX simple interactions, then Appium will become a limitation. Think about features like keyboarding. It is not so easy when complex touch/keyboard mixed scenarios are involved, the probability of a false failure is high; do not misunderstand me on this: I am not saying it is impossible to do, just not so easy as you might think!


Another little nightmare with Appium is exchanging data. When your test needs to exchange data with your app (especially in the incoming direction), you will need to play some tricks. So always consider that sending and receiving information is not that straightforward. It is not Appium's fault, the WebDriver specification was designed for automating stuff, not exchanging data!


Question: List Out The Appium Abilities?

Answer :

Appium abilities are:

  • Test Web

  • Provides cross-platform for Native and Hybrid mobile automation

  • Support JSON wire protocol

  • It does not require recompilation of App

  • Support automation test on physical device as well as similar or emulator both

  • It has no dependency on mobile device.


Question: List Out The Pre-requisite To Use Appium?

Answer :

Pre-requisite to use APPIUM is:

  • ANDROID SDK

  • JDK

  • TestNG

  • Eclipse

  • Selenium Server JAR

  • Webdriver Language Binding Library

  • APPIUM EXE for Windows

  • APK App Info


Question: What About Performance impact while running tests using Appium?

Answer :

Appium is not a huge application and requires very little memory. Its architecture is actually pretty simple and light as Appium acts like a proxy between your test machine and each platform automation toolkit. Once up and running, Appium will listen to HTTP requests from your tests; when a new session is created, a component in Appium's Node.js code called _proxy_ will forward these Selenium commands to active platform drivers.


In the case of Android for example, Appium will forward incoming commands to the [chromedriver] (90% of cases, Appium will not even change commands while routing them), this happens because ChromeDriver supports WebDriver and Selenium. For this reason Appium will not allocate much memory itself, you will see a lot of memory being allocated by other processes like [adb], ChromeDriver or the iOS automation toolkit (called by Appium while testing and automating).


Question: What Platforms Are Supported?

Answer :

Appium currently supports Android and iOS, no support for Windows unfortunately.


Question: Do I Need A Server Machine To Run Tests On Appium?

Answer :

No! Appium promotes a 2-tier architecture where a test machine connects to a test server running Appium and automating the whole thing. However this configuration is not mandatory, you can have Appium running on the same machine where your test runs. Instead of connecting to a remote host, your test will connect to Appium using the loopback address.


Question: List Out The Limitations Of Using Appium?

Answer :

  • Appium does not support testing of Android Version lower than 4.2

  • Limited support for hybrid app testing. E.g., not possible to test the switching action of application from the web app to native and vice-versa

  • No support to run Appium Inspector on Microsoft Windows and you need to use UIAutomatorViewer supported by Android SDK


Question: Explain How To Find Dom Element Or Xpath In A Mobile Application?

Answer :

To find the DOM element use “UIAutomateviewer” to find DOM element for Android application and Appium Inspector for IOS Application


Question: Explain The Design Concept Of Appium?

Answer :

  • Appium is an “HTTP Server” written using Node.js platform and drives iOS and Android session using Webdriver JSON wire protocol. Hence, before initializing the Appium Server, Node.js must be pre-installed on the system

  • When Appium is downloaded and installed, then a server is setup on our machine that exposes a REST API

  • It receives connection and command request from the client and execute that command on mobile devices (Android / iOS)

  • It responds back with HTTP responses. Again, to execute this request, it uses the mobile test automation frameworks to drive the user interface of the apps.


Question: What Language Does Appium Support?

Answer :

Appium support any language that support HTTP request like Java, JavaScript with Node.js, Python, Ruby, PHP, Perl, etc.


Question: Explain The Pros And Cons Of Appium?

Answer :

Pros:

  • For programmer irrespective of the platform, he is automating ( Android or iOS) all the complexities will remain under single Appium server

  • It opens the door to cross-platform mobile testing which means the same test would work on multiple platforms

  • Appium does not require extra components in your App to make it automation friendly

  • It can automate Hybrid, Web and Native mobile applications


Cons:

  • Running scripts on multiple iOS simulators at the same time is not possible with Appium

  • It uses UIAutomator for Android Automation which supports only Android SDK platform, API 16 or higher and to support the older API’s they have used another open source library called Selendroid.


Question: Any Tips Or Tricks To Speed Up My Test Writing Activity while I develop test scripts?

Answer :

Here is one piece of advice. Since your tests will mostly consist in automation tasks, make interactions reusable!


Do not write the same sub-scenarios twice in your tests, make a diagram of what your scenarios are and split them in sub activities; you will get a graph where some nodes are reachable from more than one node.


So make those tasks parametric and call them in your tests! This will make your test writing experience better even when you need to migrate from existing tests


Question: What Data Exchange Is when you do tesing on Mobile devices?

Answer :

When I say "data exchange" I am not referring to scenarios like getting or setting the value of a textbox. I am also not referring to getting or setting the value of an element's attribute. All these things are easy to achieve in Appium as Selenium provides commands just for those. By "data exchange" I mean exchanging information hosted by complex objects stored in different parts of your webview-based app like the window object.


Consider when you dispatch and capture events, your app can possibly do many things and the ways data flows can be handled are many. Some objects might also have a state and the state machine behind some scenarios in your app can be large and articulated. For all these reasons you might experience problems when testing.


Question: Explain What Is Appium Inspector?

Answer :

Similar to Selenium IDE record and Playback tool, Appium has an “Inspector” to record and playback. It records and plays native application behavior by inspecting DOM and generates the test scripts in any desired language. However, Appium Inspector does not support Windows and use UIAutomator viewer in its option.


Question: I Want To Run My Tests In A Multi threaded Environment, Any Problems With That?

Answer :

Yes! You need some special care when using Appium in a multi threaded environment. The problem does not really rely on the fact of using threads in your tests: you can use them but you must ensure that no more than one test runs at the same time against the same Appium server. As I mentioned, Appium does not support multiple sessions, and unless you implemented an additional layer on top of it to handle this case, some tests might fail.


Question: Can you write generic code to generate webdriver instance using Appium APIs for both Android and IOS?

Answer:

Code for same as below:


AppiumDriverFactory.java Class


EnvironmentPropertiesReader.java Class



config.properties file



Question: Write a method to wait for specific element to appear on mobile app?

Answer:


Question: Write a method to wait for specific element to vanish on mobile app before certain interval?

Answer:


Question: Write a method to perform single tap using appium?

Answer:


Question: Write a method to perform double tap using appium?

Answer:


Question: Write a method to perform touch sequence from one element to other element?

Answer:


Question: Write a method to perform multi touch sequence containing different elements?

Answer:


Question: Write a generic method to get any element by any locator in appium?

Answer:



#NGAutomation

Building better QA for tomorrrow