Automation testing is not only limited to the web applications but is also more and more important for native mobile apps. Appium is a free and open source testing framework for mobile automation. Since it is a common topic for interviews, so we’ve picked up 20 best Appium questions and answers to help our readers.
Appium is easily integrable with Selenium Webdriver and provides wrappers APIs that translates its commands into iOS and Android specific formats according to the device type in use.
Appium can work with almost all languages that Selenium supports. For example, Selenium provides libraries for Java, Python, PHP, C#, Ruby and much more. It brings cross-platform support which means the same API would work on both the iOS and Android devices. And you won’t need to make any changes to the Selenium test scripts.
In this post, we tried out best to provide you all required knowledge about the Appium. Let’s now dive into the world of mobile test automation.
- What is Appium and why do you need it?
- What’s that one point which made you choose Appium for mobile app testing?
- How many types of apps do you know?
- What are all the pre-requisites for setting up Appium?
- Why should you use Appium? List down some of its advantages.
- What are the known limitations of Appium?
- What would you prefer to test on real devices or use simulators/emulators?
- How do the tests run on simulators/emulators?
- What are the key design concepts behind Appium?
- Which are the test frameworks that Appium supports?
- What are the essentials for writing the Appium tests?
- How would you retrieve a DOM element or the XPath in a mobile app?
- What is Appium inspector and why is it used?
- What are the probable errors you might see while working with Appium?
- What’s the alternative way to interact with mobile apps while using Appium?
- Can you run multithreaded tests in Appium?
- Does it require an <.apk> file for automating tests in Appium?
- How to debug failures in Appium test automation?
- Which are the Selenium commands to use with Appium?
- Does it require a server node to execute Appium tests?
Appium is a free mobile testing tool and available as an open source from the GitHub. It has easy integration with Selenium Webdriver that’s what making it more famous.
Now, do you need it? It would solely depend on your requirements. But first of all, you’ll need to understand when should you use Appium. For example, if you are an app developer or a mobile app tester who wants to verify his app on multiple platforms. Then Appium can help you in doing that.
On the contrary, if your app is only for a single platform, then it’s not worth putting efforts in learning and using Appium for test automation.
It has a unique design which natively supports Selenium. And Selenium is one of the most used and evolving technology for automation testing. It has an open support from the global browser vendors like Google, Mozilla, and Safari. Each one of them agreed to provide their Web drivers implementing the Selenium interfaces. Next, it is cross-platform enabled, supports all popular programming languages, and webdriver makes its tests more scalable. You need to write tests once which you can run anywhere.
Mostly there are three kinds of apps in use.
- Native apps are those which are built using the iOS/Android SDK.
- Mobile web apps are the ones which are getting accessed via the mobile browsers.
- Hybrid apps fall into the category which wraps around a <webview>. It’s a native control to enable interaction with the web elements.
You can track all the prereqs from the below list.
- Android SDK,
- Eclipse SDK,
- Compatible JDK version,
- Selenium Standalone Server Jar,
- Required Web driver library,
- Appium for Windows or any other platform you are using,
- APK App info on Google play,
Appium tool has many benefits, some of them are as follows.
- It’s a multi mobile platform enabler for testing applications.
- It makes you choose the programming language which comforts you most.
- It’s free, open source and supported by a large developer community.
- It supports Selenium and JSON wire protocol to enable effective testing.
- It doesn’t require you to make modifications to your app.
- You can start scaling the tests as you go.
- It doesn’t have any dependency on the mobile devices.
- It enables testing on physical devices as well as on the emulators as well.
Though it has more pros than cons which we’ve already given in the previous question. But there are few things which are worth mentioning as Appium limitations.
- The minimum Android version it supports is 4.2. It might not work on the lower versions.
- It has little support for testing the hybrid apps. It doesn’t allow the switching from web app mode to native or vice-versa.
- If you need multiple sessions, you need to add this support yourself. Appium doesn’t do it by default.
- You can’t run appium inspector in Microsoft Windows.
It’s one of the most commonly asked Appium interview questions. You’ve to be little logical and practical while answering it. Don’t just simply answer “It would depend on what you need.”. Because it would be a layman answer which interview won’t expect from you. Rather you should explain it by example.
You can say something like that it’s always best to test on real devices. As it would allow you to catch errors that you may not detect otherwise. But you have to configure the device smartly with the Appium server so that it can detect the device. Sometimes the ADB, the Android debugger may disconnect from the device even if it remains plugged in. And it can cause your tests to fail. To handle such issues, you can write a module which resets the ADB after some time to re-connect the devices.
The limitation of disconnecting from the devices would never occur with the emulators. They will remain attached to the ADB. You may even set orientation and other hardware-based features that it can emulate.
Running entirely in a virtual world wouldn’t come without some limitations. Your tests would run slow as the emulators consume a lot of memory. Even they might behave intermittently during the execution.
But you can start early testing with them till you acquire the real devices.
- It’s the <Node.js> server that powers Appium to support cross-platform device testing. And it uses the Webdriver’s JSON wire protocol to run iOS and Android sessions.
- Once you have the Appium downloaded and installed, it runs an HTTP server which exposes services via REST APIs.
- This server is responsible for processing the commands from the client and executing them on the target platform.
- It returns the response in HTTP format which the system handles in an appropriate manner.
- It utilizes Apple’s <Instruments> for iOS to control the user interface of the target apps.
- For Android devices, it uses Google’s <UIAutomator> to access API level 16 or higher.
- There is <Selendroid> to enable access to level 15 or less.
- Appium doesn’t have built-in or default support for any test frameworks.
- You can use it with many testing tools like Selenium Webdriver.
- There are some unit test frameworks like <NUnit> and <.Net> which you can use with Appium.
- Appium provides a driver module that’s what you need for writing test cases.
There few things that you need before starting to write test cases in Appium.
- Driver – It provides a set of APIs to write your Appium tests. It then sends the commands to HTTP server for processing.
- Session – All Appium tests needs a session for execution. So, first of all, you have to create it. Close it after the automation ends.
- Capabilities – Like you have to set Chrome driver path to start executing tests in a Chrome browser. Similarly, here you need to define params like PlatformName, PlatformVersion, DeviceName and so on.
- Commands – These are action words which you use in test steps while you write test cases. Appium has a rich set of commands. Read their syntax and purpose from its online documentation.
Just like the <FirePath> does in Firefox for Selenium, here you have the <UIAutomateviewer> to locate any element for Android app.
It is similar to the Selenium IDE plugin and enables the record and playback support in Appium. It captures the moves of a native application by inspecting DOM and produces the test scripts in any desired language. However, Appium Inspector does not support Windows and use <UIAutomator> viewer in its option.
Following are the errors you might observe with Appium.
- Error#1: Missing desired capabilities e.g. Device Name, PlatformName.
- Error#2: Couldn’t locate ADB. You may have missed setting the <ANDROID_HOME> environment variable.
- Error#3: Selenium exception <openqa.selenium.SessionNotCreatedException>. It indicates a failure in creating a new session.
- Error#4: Failure in locating a DOM element or determining the XPath.
Yes, you can. Appium doesn’t prevent you running the tests in a multithreaded environment. Just make sure that no more than one test runs at the same time against the same Appium server.
Yes, you need the <.apk> package to automate using Appium.
You have to download the Appium source from GitHub to enable debugging. And then you need to set up a proxy component to add break points.
There are a no. of Selenium commands to operate with Appium tool.
- Locate commands using ID or class names.
- Raise events on elements e.g. Click().
- Text commands like type().
- Get/Set element properties.
- Switch context between different web views like switching <iFrames> in Selenium Webdriver.
- Commands to manage alert boxes.
No, you don’t need a server node to run tests on Appium. It comprises of a 2-tier architecture where a test node connects to a server running Appium and carries out automation. So, you can have Appium tests running on the same node where your test runs.
Summary – 20 Appium Questions and Answers.
Hope this post out of the series of Selenium interview questions would be able to provide you the required information on the Appium tool. After reading the above stuff, if you want to share your experience or want to send any correction, please use the comment box to let us know.
If you liked the content, then do share the set of these 20 Appium questions and answers with your friends and on the social media.