Part II — Not Only Desktop

Part II — Not Only Desktop

In Part I we covered how Selenium is used for testing desktop browsers. But, hey, it’s 2018 and testing desktop web is only a part of the story. We also have Web applications running on mobile devices (and on other platforms such as TV and wearables which we will skip as my knowledge in this area is limited to non existent…). While this topic is covered in many articles, we will go thru the main areas so to have better understanding how Selenium may be used to test on non desktops.

A Mixture of Platforms

One way to understand the various platform is to try to look at it as a matrix. On one axis we have the various operating systems on which the software will run. And on the other axis we have the technology used for developing it:

Platform Matrix

Operating Systems

There are 2 main types of platforms that exist: desktop and Mobile (actually, these lines are becoming blurred with things like Chromebook on one hand and wine on the other), but let’s stay there for a minute. Desktop and Mobile platform run a specific set of Operations Systems. On Desktop that is Windows, Linux and MacOS. On Mobile the popular operating systems are iOS (for Apple products) and Android (for the rest of the Universe).

Development Technology

On those Operating systems we can run 3 types of applications:

  • Web based app — that means applications that run inside a browser installed on our platform, such as Chrome or Firefox. The application is developed in “Web Technology” — meaning the technology that the web browser can understand and execute: HTML pages, CSS and Javascript files. Chrome and Firefox are cross platform browsers that can run on a large variety of Operations Systems, both desktop and mobile. Some browsers are limited to specific OS, such as Edge or Safari.
  • Native Applications — those are applications that are compiled to run on a specific Operating system. When referring to mobile, this is a native code development such as Swift for iOS and Java for Android. On desktop OS it can refer to any machine compiled development language such as c++.
  • Hybrid Applications are, as the name implies is well, an hybrid of the two. It is a web browser wrapped with a native applications that runs on the target OS. This allows developing the code in web technologies, but execute it on different platforms. For mobile this is achieved by using Cordova tools (aka PhoneGap) for creating iOS, Android (and Windows) apps. For desktop operating systems this is achieved via Electron.

Testing the Platforms Plethora

With so many technologies, we need tools to test all of them. Thanks to the fact that the Webdriver API are evolving as a standard for browser automation / testing, more tools could grow while leveraging the standard to develop tools for testing different types of applications. So:

Desktop Apps

Testing web apps on desktop is achieved by using a selenium server or by bypassing it with direct browser APIs, as described in the previous chapter.

Testing Hybrid apps, developed with Electron is by using Atom’s (Electron developers) Spectron.

Mobile Apps

Google’s Espresso can be used for Android apps only, but the dominating tools for testing mobile devices is currently Appium, mainly thanks to its support for both iOS, Android and Windows Mobile.

Meet Appium

Appium is dated back to 2012, and has been re-written 3 times in 3 different languages. It was originally developed to support iOS testing automation but then was extended to support Android and recently also Windows. It is currently the only test framework that is cross mobile platform.

Appium is built on the idea that testing native apps shouldn’t require including an SDK or recompiling your app. And that you should be able to use your preferred test practices, frameworks, and tools. Appium is an open source project and has made design and tool decisions to encourage a vibrant contributing community.

Appium provides a Webdriver API compliant server that receives the requests from your favorite language bindings and transfers them to the Mobile platform. Talking to the Mobile device is by using the specific OS tools, such as UI Automator for Android and Xcode UI Test for iOS (and yes, also for Windows mobile).

Appium can be used for testing applications on mobile devices such as mobile web, but running a browser on the device, and native and hybrid apps, by installing and executing the specific app on the device.

Because Appium uses the standard APIs, any language binding that is generating Webdriver HTTP requests, may also be used for running Appium. Well, almost: the language for mobile OS testing need to support the APIs that are mobile device specific, such as install app, unlock device and perform a swipe gesture.

Need someone to help you around the E2E testing world? Read the whole series. If you are happy and joyful — you may clap!