The Basics of Mobile Web Testing on Real Devices Using Selenium

Basics of Mobile Web Testing Using Appium

Dear Testdroiders,

Many of today’s apps utilize Internet browsers and web technologies, even those native apps on Android and iOS. The effectiveness of testing these apps varies widely among users, which frameworks and tools are used. Majority of teams that are building either solely native, hybrid or web apps use Agile methodology wherein test automation has a significant value to offer.

We’ve introduced support for variety of different frameworks since Testdroid was launched – and one of the great use case (and benefit) for this approach is the flexible use of real mobile devices, real mobile browsers and different types of apps – with the diverse selection of different test automation frameworks.

We discuss about different test automation frameworks here at Testdroid blog quite often, and now we’ll take a look at how Appium/Selenium can be used to test your mobile web stuff running on REAL environments (real devices and browsers, and not emulators). Don’t forget to download an ultimate guide here to use selenium to run mobile web tests on real devices.

Appium and Selenium

First Thing First: Appium equals Selenium

Appium is like Selenium – but for mobile apps and games“. You’ve probably read/heard this several times before, but in fact, Appium is much more than that. Appium is also suitable for mobile web testing, when real devices and real browsers are used in testing. Emulators won’t do the trick as e.g. Chrome cannot be even installed on standard Android QEMU-based emulator. Some emulators may work (with Chrome), but why bother – those are still emulators and no single end-user uses emulators to run your app, game or web products. With the same effort (and cost) you can build your test automation with Appium using real stuff.

In a nutshell, Appium is a mobile test automation framework (with a tool) that works for all: native, hybrid and mobile-web apps for iOS and Android. Appium is a great choice for test automation framework as it can be used for all these different app/web types. Basically, Appium derives its roots from Selenium and it uses JSONWireProtocol internally to interact with iOS and Android apps using Selenium’s WebDriver.

In its architecture, Appium is an HTTP server written in Node.js that creates and handles multiple WebDriver sessions. Appium starts tests on the device and listens for commands from the main Appium server. It is basically the same as the Selenium server that gets HTTP requests from Selenium client libraries.

Appium 'Behind the scene'

Appium has proven its flexibility and scalability in native mobile app and game testing, as those apps and games built by app and game developers tend to be pretty much identical on both platforms, Android and iOS. The benefit of having these sort of cross-platform framework helps using the identical script either app/game is running on either platform. The very same applies for mobile web. Appium scripts run nicely whether you are testing website on Chrome, Firefox, Safari, WebKit-based browser on Android and iOS (where applicable).

Another significant benefit of Appium is that users can write tests using their favorite development tools, environment and programming language, such as Java, Objective-C, JavaScript, PHP, Ruby, Python or C#, among many others.

How to Get Started and What Things to Consider?

Don’t worry about the learning curve. If you are familiar with Selenium, then you’ve got Appium covered: They use the same WebDriver, and DesiredCapabilities is used the same way. There is a great chance your existing Selenium test scripts work as they are with Appium setup. Nevertheless, configuring an application to run on Appium has a lot of similarities to Selenium — for example, those DesiredCapabilities. If you are looking an easy way to get started, check this out. These instructions provide you everything to ensure a smooth start with Appium, real devices and real web browsers.

Bear in mind that the mobile ecosystem is very different compared to the desktop world. As mobile OEMs are building their own stuff, they also tend to ‘differentiate’ things on various standard things – such as browsers. In fact, mobile browsers – regardless how standard they are – is also one of those areas where almost all devices manufacturers want to add their ‘innovation’ and this is quickly leading to a happy mix of different webkit versions with different functionalities. That combined with the OS version, hardware configuration, different sizes of displays, memory and so on can significantly ‘differentiate’ what user gets as form of these browsers. Building your test scripts with Appium/Selenium and automating testing can quickly get you understanding how well does your web stuff work on those devices and browsers.

Another area that any mobile web developer needs to pay attention at is performance: Web page rendering time vary significantly from one device to another and to ensure acceptable end user experience you need to test how your CSS & Javascript renders across devices. There are already great benchmarks – such as BrowserMark by Rightware – that can be used to measure the performance of hardware together with certain version of a browser. This gives understanding how well certain work load (unfortunately not configurable nor your own web stuff is usable on these browser benchmarks) does on certain device with certain web browser. But to understand how your own web stuff behaves under different conditions, test automation with Appium/Selenium has a lot to offer.

Selenium has already cemented its place as a de-facto web test automation standard and Appium is providing very clean high level API that can be quickly adopted by Selenium developers, as it nicely abstracts lot of the messy stuff related to running tests. Our Testdroid Cloud provides this sort of environment where everything is packaged and pre-build for your Selenium / Appium tests, using only real mobile devices (Android and iOS) and real browsers that are usable with those devices (Safari for iOS, Chrome, WebKit, Firefox and others for Android).

Example: Appium for Mobile Web Testing

Here is one example how we’ve enabled Appium with real devices and real browsers, using the Testdroid infrastructure to get Selenium-based test scripts up and running on real devices.

Happy Web Testing!

The Ultimate Hands-on Guide to Successful Mobile Web Testing

Learn how to do mobile web testing more efficiently and effectively and reap the benefits of it.