Q. What is Appium and why do you need it?
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.
Q. What’s that one point which made you choose Appium for mobile app testing?
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.
Q. How many types of apps do you know?
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.
Q. What are all the pre-requisites for setting up Appium?
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,
- TestNG,
- Appium for Windows or any other platform you are using,
- APK App info on Google play,
- JavaScript.
Q. Why should you use Appium? List down some of its advantages.
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.
Q. What are the known limitations of Appium?
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.
Q. What would you prefer to test on real devices or use simulators/emulators?
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.
Q.How do the tests run on simulators/emulators?
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.
Q. What are the key design concepts behind Appium?
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.
Q. Which are the test frameworks that Appium supports?
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.
Q. What are the essentials for writing the Appium tests?
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.
Q. How would you retrieve a DOM element or the XPath in a mobile app?
Just like the <FirePath> does in Firefox for Selenium, here you have the <UIAutomateviewer> to locate any element for Android app.
Q. What is Appium inspector and why is it used?
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.
Q. What are the probable errors you might see while working with Appium?
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.
Q. What’s the alternative way to interact with mobile apps while using Appium?
You can use JavaScript to interface with the mobile apps. You can employ the Appium commands to send the script to your app. Just wrap it in a static function and execute.
Q. List out the feasibilities of Appium.
It is helpful for testing web-based applications in a fast-paced environment.
Eliminates the need for recompilation of the Appium app.
Allows test automation on both actual devices as well as an emulator.
Reduces the dependency on mobile equipment.
Q. Is a server machine mandatory for running tests on the automation tool?
Appium works on the concept of 2-tier architecture wherein connectivity is established between the test machine and the test server that automates the tests on the Appium. It is possible to have a shared environment for both Appium and the test to be executed.
Q. What are mobile browsers can be automated using the Android emulator?
The stock browser is the only platform supporting automation in Android emulators resembling Google Chrome.
Q. Is integration with apps possible with Javascript while using Appium automation framework?
Yes it is feasible for app to interact with JavaScript during the command execution on the automation framework. The server sends the test script to the app requesting for the test execution.
Q. What file is mandatory in android device to automate a test script on Appium?
.apk file is mandatory to run the test script using Appium.
Q. What Is Appium Inspector And Why Is It Used?
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 uses the <UIAutomator> viewer.
Q. What Are The Probable Errors You Might Come Across While Working With Appium?
The 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.
Q. What Are The Problems Faced While Running A Test In A Multithreaded Environment?
You need special care while using Appium in a multithreaded environment. The problem does not 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. Appium does not support multiple sessions, and unless you have implemented an additional layer on top of it to handle this case, multiple tests might fail.
Q. List The Selenium Commands That Work With Appium.
There are a number of Selenium commands that work 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.
Commands to run JavaScript.
Switch context between different web views like switching <iFrames> in Selenium Webdriver.
Commands to manage alert boxes
Q. List OneThing Which You Cannot Do With Emulators But You Can Do With A Real Device.
You can test the interrupts like
Phone calls & Messages
Battery drains out while using the application under test
Low battery scenarios
Memory card mount/unmount scenarios
Actual performance of your application
Bluetooth related testing.
Q. Which Tools Are For Performance Testing And Automation?
For performance testing of web services, you can use JMeter. It is an open-source tool which can be used to test the API’s performances.
For automation, there are several paid tools available in the market like SeeTest, Ranorex, Silk Mobile etc while free automation tools are Calabash, Appium, Robotium for Android, KIF for iOS.
Q. What Are The Tools Used In Debugging?
We generally use logs to see the cause of the issue, where the failure is occurring. So for iOS – iPhone configuration utility & for Android Monitor.bat, etc can be used. If you provide logs from these tools to the developer, they can easily understand the cause of the issue.
Q. Mention The Basic Requirement For Writing Appium Tests.
For writing Appium tests you require:
Driver Client: Appium drives mobile applications as though it were a user. Using a client library you write your Appium tests which wrap your test steps and sends them to the Appium server over HTTP.
Appium Session: You have to first initialize a session, as such Appium test takes place in that session. Once the Automation is done for one session, it can be ended.
Desired Capabilities: To initialize an Appium session you need to define certain parameters known as “desired capabilities” like PlatformName, PlatformVersion, Device Name and so on. It specifies the kind of automation one requires from the Appium server.
Driver Commands: You can write your test steps using a large and expressive vocabulary of commands.
For more Click Here