Appium Interview Questions for Experienced and Freshers (2017)

0
1310

By: Nikhil Srivastava

Below are top 30 Q&As on Appium mobile test automation tool. Refer these to crack most of the interviews on appium automation. Try to grasp the concepts and technologies behind appium automation while going through the answers of each of these questions. The answers are in their simplest form to help you understand the appium concepts easily.

  1. What is Appium Mobile Automation Tool?

Answer:  Appium is a mobile automation tools. Mobile automation here refers to the automation of mobile applications. Applications may be Native apps, Mobile web apps or Hybrid apps. Appium is cross-platform and open source tool.

Cross-platform means we can write tests in appium in multiple platforms i.e. android and ios using the same API. Thus, we can use the same code to run our test suite on iOS or Android platforms. It’s one of the most useful advantage of Appium tool

2. How Appium Setup is done on Android Devices?

Answer:

Using Appium on Android devices has some pre-requisites. You need to have following in order to use appium for android:

JDK 7 or higher – Install JDK first on your system

Android SDK – Install Android SDK version 17 or higher on your system

Packages – Install any required package for you Android platform version in the Android SDK Manager

AVD – Android Virtual Device is an emulator that is similar to the android device

Appium.exe/ Appium.app  – Install Appium executable on your system which provides a GUI based tool available for using appium. If you wish to use the latest Appium, install Appium from Source and run it from the command line.

3. What are prerequisites of Appium.

Answer: The prerequisite of using Appium are based upon the environment, browser and libraries. Following are the basic prerequisites for using Appium that you should know about and should install on the required platforms.

Android Requirements

  • Android SDK API >= 17 (Additional features require 18/19)
  • Appium supports Android on OS X, Linux and Windows. Make sure you follow the directions for setting up your environment properly for testing on different OSes

iOS Requirements

  • Mac OS X 10.7 or higher
  • XCode >= 4.6.3
  • Apple Developer Tools (iPhone simulator SDK, command line tools)

Firefox OS Requirements

4. What is Appium Inspector?

Answer:

Appium Inspector is a GUI tool similar to Selenium IDE. It enables the user to check out the hierarchy of the mobile application. Appium Inspector is used for:

  • To understand the element hierarchy
  • To find the xpath, name and value of the objects
  • To record the manual actions

5. Explain Appium architecture.

Answer:

At the heart of Appium lies a web server that exposes a REST API -receives connections from a client, listens for commands, executes those commands on a mobile device and responds with an HTTP response representing the result of the command execution.

Since it’s a client server architecture, there are numerous possibilities of using writing test code in our preferred language that consist of http client API. Thus, you can use any of the option from the available Appium client libraries to write your test code.

6. What are the advantages of Appium?

Answer:

Below are few of the main advantages of Appium Automation:

  • Due to Json Wire Protocol usage, we can use any programming language
  • Testing of Native, Hybrid and Web Apps is possible using appium
  • Appium supports multiple frameworks
  • It’s an open source and cross-platform tool
  • It’s compatible with CI tool like Jenkins as well
  • Uses selenium API thus no need to learn from scratch
  • Can be used with Emulators as well as real devices

7. What are limitations of Appium ?

Answer:

Below are few limitations or challenges of Appium:

  • It takes lot of initial efforts for configuring appium both on Android and iOS platforms
  • Image comparison is not possible using Appium
  • Unexpected errors are observed quite often which sometimes takes time for resolution
  • Android API level < 17 is not supported by Appium (Selendroid needs to be used otherwise)
  • Execution of scripts is slow on iOS platform
  • Limited gesture support is available in Appium

8. Should we test apps on real devices or on simulators, which is more preferable?

Answer: It’s preferable always to test the applications on real devices. However, due to the increasing number of devices, it’s quite difficult to test the applications on every new device, thus it’s much better to use emulators in such cases. Emulators configuration is easy and quick.

Hence, if the device is available it’s better to use the device only otherwise go for Emulator.

9. What are the languages supported by Appium?

Answer:

  • Objective C
  • Javascript with Node.js
  • PHP
  • Python
  • Ruby
  • C#
  • Clojure
  • Perl

10. How do we identify elements of any mobile app using Appium.

Answer: You can use Appium Inspector which is a GUI based tool similar to Selenium IDE. It shows the hierarchy of the mobile application elements that is being automated. So you can get all the properties for each element using the inspector.

11. Can we use Javascript in Appium to perform app automation?

Answer:

Yes, we can use JavaScript to automate applications using Appium. Any language that supports HTTP request can be used with Appium. The reason behind this is simple, Appium is an Http server thus it accepts http request in the form of Http sessions for execution of Appium commands.

Other languages like Java, Ruby, PHP, Python, Perl, Node.js are other examples of the languages which support Http request.

12. What type of Mobile apps can be automated using Appium.

Answer: You can automate Native, Web and Hybrid mobile applications using Appium

13. Can we perform Parallel tests using Appium.

Answer:

We can set multiple Android sessions on a single machine using Appium. All you have to do is to start multiple Appium servers with different flags. There are number of important flags for automating multiple android session on the system:

-p :  the main Appium port

-U : the device id

-bp :  the appium bootstrap port

–chromedriver-port : the chromedriver port (if you are using webviews or chrome)

–selendroid-port: the selendroid port (if you are using selendroid)

For automating 2 devices with IDs 12345 and 54321, you need to use the below commands to achieve parallel testing.

node -p 4492 -bp 2251 -U 54321

node -p 4491 -bp 2252 -U 12345

As long as your Appium and Appium bootstrap ports lie in the range of 0 to 65536, the only requirement is that these port should be different so that the appium servers listen to different ports. You need to make sure that you use -u flag with the correct device id. Appium can connect to unique device in this way only.

For chromedriver or selendroid, you need to set different port for each server.

# In order to perform parallel testing on iOS device, you have to use Sauce since appium doesn’t have a direct support for parallel testing on iOS devices.

14. What are Appium.app and Appium.exe

Answer:

Appium supports desktop apps on OS X and Windows using Appium.app and Appium.exe. There are ready to run versions of Appium. There is no need to run the source code if we use these executable files directly on the system.

These executables are primarily GUI wrappers around the Appium server. These files contains everything that is required to run the Appium server including the Appium Inspector. Thus there is no need to go into the technicality of Node.

15. What is fruitstrap. What is its use?

Answer:

Fruitstrap is a third-party tool to deploy the application build on a real iOS devices. For automation, Appium installs the testing application on the iOS device using Fruitstrap.

16. Can mobile gestures be automated using Appium?

Answer: Yes, Mobile gestures can be automated using Appium. Using TouchActions api, mobile gestures can be automated. TouchActions is similar to Actions class in Selenium. In addition, JSON wire protocol extensions are also enabled in TouchActions.

Gestures like tap, flick, swipe, scroll, shake can be automated using appium.

17. What is the default port number used for Appium Server?

Answer: 

Default port number used for Appium Server is 4723. You need to mention the same while writing desired capabilities in the initial lines of code.

18. What is Appium Philosophy?

Answer:

Appium was designed to meet mobile automation needs according to a philosophy outlined by the following four tenets:

  1. You shouldn’t have to recompile your app or modify it in any way in order to automate it.
  2. You shouldn’t be locked into a specific language or framework to write and run your tests.
  3. A mobile automation framework shouldn’t reinvent the wheel when it comes to automation APIs.
  4. A mobile automation framework should be open source, in spirit and practice as well as in name!

19. Name the Appium Client Libraries.

Answer:

Java, Ruby, Python, PHP, Javascript(Node.js) and C# are the appium client libraries used for extension to the WebDriver protocol. You can use these libraries in order to use your favorite language for automating your mobile application.

20. What are Appium Desired Capabilities and what are they used for?

Answer:

Desired capabilities are nothing but a kind of SET data structure as we use in Java. It may be a Map or Hash. Basically, these are used to send sets of keys and values to the Appium server to let it know what kind of automation session we want to start up.

Also the desired capabilities can be used to modify the server behavior while automation is running.

Few of the commonly used desired capabilities are:

  • platformName: To notify the appium server the platform we will be using for automation (e.g. values you can use are android/ios etc)
  • autoLaunch: To notify Appium server whether to automatically install and launch the application or not.
  • browserName: To notify the name of mobile web browser to be used for automation. If you are not using any app, keep the value as empty string.
  • safariAllowPopups: To allow use of Javascript popups while using Safari automation session.

There are number of desired capabilities that can be used for android and iOS platforms. Refer this link to know them all: http://appium.io/slate/en/v1.0.0/?ruby#appium-server-capabilities

21. What is the limitation of running Appium on Linux.

Answer:

You can’t install .app executable on Linux machine. It means that you won’t be able to test iOS applications using Appium on a Linux machine.

22. What are advantages of using Appium on Sauce Labs.

Answer:

  1. You save the time it takes to setup the Appium server locally.
  2. You don’t have to install/configure the mobile emulators/simulators in your local environment.
  3. You don’t have to make any modifications to the source code of your application.
  4. You can start scaling your tests instantly.

23. How can we use Appium from Command line.

Answer:

http://testdroid.com/news/appium-tip-7-mastering-appium-through-the-command-line

Follow the below steps in order to run Appium from Command line:

  1. Download and compile the source code of Appium from this link first – https://github.com/appium/appium
  2. Once compiled you need to build it, Appium comes with a script to handle the build process. It can be little tedious to build if you are building for the first time. Check how to do enviroment setup for Appium first in case you face any problem while building the compiled source code.
  3. Run appium-doctor.js from bin folder to check if your machine is ready for the automation.
  4. Use this command to support all the usual automation needs for both Android and iOS: $ ./reset.sh –android –selendroid –ios –real-safari –verbose
  5. Once the Appium Server built is complete, now you need to connect your device and accept all the Trust related dialogs which come. Make sure Developer and USB debugging options are enabled (in case of android). For iOS devices, you need to enable UI Automator in the Developer option as long as the device is visible in XCode devices window (cmd + shift + 2 on mac). Also open up Instruments from Xcode and select your device as the active one.
  6. Use Appium.js to run the sever.You can connect multiple android devices but only one iOS device at a time.
  7. Your appium server should be running now. You just need to point to this server from your tests in order to perform execution.If the server is running in your local host and in the default port following is the address which your webdriver should be pointed towards: http://localhost:4723/wd/hub

24. How to debug appium tests?

Answer:

Debugging Appium tests is not a very difficult task. Its a Node.js application. Thus, in its core it has javascript. The free source code can be downloaded from the Github. Debugging deeper is required sometimes if the issue is complex. One way to go for easy debugging is to set breakpoint at key points. For e.g. setting a breakpoint for the “proxy” component. In the source code, refer from the file from the path “appium/lib/server/proxy.js” set a breakpoint for the function doProxy(req,res). This will enable the compiler to hit at this breakpoint every time the commands are sent to platform-specific components. The are the commands which gets converted into automation commands.

25. Can we do data exchange using Appium?

Answer: This is one of the weakest point of Appium. The data exchange part is quite a complex task to perform using Appium. Simple data exchange is possible easily using the available Appium and Selenium APIs like writing data in the fields etc. However for complex data exchange such as fetching the state of application or data exchange by complex objects in the web-view of applications, Appium is not much useful for such cases and it’s a better approach to go for manually writing the test cases specific to every platform.

26. Mention the possible errors you might encounter while using Appium.

Answer:

Below are few error examples which are usually observed in Appium.

  • Failed to start Appium session, Instruments did not launch successfully
  • Android hybrid mobile app: Getting Unhandled error: Error: getaddrinfo ENOENT in appium, wherein a session could not be created #6610
  • Appium v1.3.0-beta1 & xCode 6.1, Failed looking up pid of launched process
  • Clicking on Inspector icon nothing is happening
  • error: Failed to start an Appium session, err was: Error: Could not find zipalign in tools, platform-tools, or supported build-tools under “/Applications/AndroidStudio.app/sdk”; do you have android SDK or build-tools installed into this location? Supported build tools are: 17.0.0, 18.0.1, 19.0.0, 19.0.1, android-4.2.2, android-4.3, android-4.4

You might face similar errors even more while using Appium. An automation enginner is always expected to solve such issues. In order to resolve the issues, google such issues first or try to do some changes in your code and do trial and error or look for some configuration changes which might resolve the issues.

27. Explain Appium Philosophy. In other words, what are the main principles on which Appium mobile automation is based upon.

Answer: Appium was basically built up for mobile automation. To meet  the requirements of mobile automation, four principles were followed upon. These principles are called nothing but Appium Philosophy. These are:

  1. For automating your mobile application, you should not be required to recompile or modify it in any form.

It means you should be able to automate the mobile application in the same state in

which it is built up originally without doing any changes or modifications in it.

  1. There should not be any binding of any specific language usage or usage of any

specific framework in order to automate your mobile application using Appium.

  1.    No need of any new APIs for Appium. There should not be any need to create new

Set of APIs for Appium. It should be possible to use any existing API set to automate

mobile applications (Thus the use of Selenium Webdriver APIs in Appium happened) 

  1.    The concept of Open Source should be in existence for the mobile automation

Framework built. There should be no bindings on the framework usage and its

code should open source so that anyone can use it.

28. Is it difficult to do Appium Setup?

Answer:

The real answer to this question is Yes. Initially you may find setting up the Appium environment quite tedious. However, once understood, you will find it quite easy to setup appium as per your needs.

Setup differs with the operation system like Android and iOS and there are several things to be taken care of while configuring appium such as using proper values in desired capabilities, providing proper device ids etc.

 

  1. Does Appium requires a Server Machine to be used?

Answer:

No, Appium doesn’t require any server machine in order to perform automation. It’s a client based architecture wherein both the test client and the test server can be setup on a single system thereby avoiding the need of any kind of remote machine acting as a server.

 

  1. Mention one of the critical thing to automate using appium?

Answer:

Data exchange is one of the critical area for Appium since Appium is not designed in a way to exchange complex data. Sending data in the app is possible using Appium but exchange of data between complex objects of webview of the application is quite a critical thing to do using Appium.

Leave a Reply