Automation testing is not only limited to 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, we’ve picked up the 20 best Appium questions and answers to help our readers.
Appium is easily integrated with Selenium Webdriver and provides wrapper APIs that translate its commands into iOS and Android-specific formats according to the device type in use.
In this post, we tried our best to provide you with all the required knowledge about Appium. Let’s now dive into the world of mobile test automation.
Appium is a free mobile testing tool and is available as an open source from GitHub. It has easy integration with Selenium Webdriver that’s what makes 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 your 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 effort into learning and using Appium for test automation.
It has a unique design that natively supports Selenium. And Selenium is one of the most used and evolving technologies for automation testing. It has open support from 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 that are built using the iOS/Android SDK.
- Mobile web apps are the ones that are getting accessed via mobile browsers.
- Hybrid apps fall into the category that 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 which are as follows.
- It’s a multi-mobile platform enabler for testing web 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.
However, it has more pros than cons which we’ve already given in the previous question. But there are a few things that 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 a 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’s answer which the interviewer 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 that resets the ADB after some time to reconnect 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 that 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 API 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 the HTTP server for processing.
- Session – All Appium tests need a session for execution. So, first of all, you have to create it. Close it after the automation ends.
- Capabilities – You have to set a 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 that 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 the Android app.
It is similar to the Selenium IDE plugin and enables record and playback support in Appium. It captures the moves of a native application by inspecting the DOM and produces the test scripts in any desired language. However, Appium Inspector does not support Windows and uses <UIAutomator> viewer as 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 from 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 breakpoints.
There are a number of Selenium commands to operate with the 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 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 will be able to provide you with the required information on the Appium tool. Here are some more popular stuff from our website.
- Selenium WebDriver Appium Quiz – Mobile Test App Automation
- Android Studio Tutorial: Create an Android App
- Android Development Studio Tutorial for Beginners
- Top 10 Java IDE for Web Development
- Your First AngularJS Application – A Tutorial for Beginners
After reading the above stuff, if you want to share your experience or want to send any corrections, 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 social media.