DrupalCon Vienna 2017: Test Automation for Drupal 8 in Mobile Devices and Tablets

The Increasing Mobility of the Internet

As technology progresses, one reality that the Drupal community must address is the increasing prevalence of the internet in mobile devices. In fact, according to the independent web analytics firm StatCounter, in October 2016, for the first time, mobile and tablet devices accounted for 51.3% of internet usage, while desktop browsers accounted for 48.7%. The trend for mobile and tablet internet use is likely to increase, and Drupal 8 development must take this fact into account not only during the project planning and development stages, but also while conducting quality assurance. To put it simply, Drupal 8 projects have to develop with mobility in mind, since all signs indicate that the future of the internet is mobile.



Because Drupal 8 development should increasingly take into account mobile and tablet devices during development, in Dev Ops the test and quality assurance phases should also keep mobile and tablets in mind to a greater degree than has been done in previous practice. In my experience, both the development and quality assurance mindsets are still stuck in the desktop browser world, which statistics are showing to become less and less prevalent as time and technology move forward. The goal of development must expand to include internet-enabled technologies that people carry around and use in all settings and situations. We in the Drupal world should not just keep pace with the new reality of internet usage, but should take the lead in the development and quality assurance of the new reality of how people use the internet.

Testing Drupal 8 Mobile Environments

Mobile devices and tablets should not be regarded as simply smaller versions of the canonical desktop browsers, but as separate environments that employ instances of mobile-designed browsers that interact in a separate environment from the desktop variety. Since Drupal 8 projects should develop for these different environments, we should then also test for the different environments. For the mobile world, the Android and iOS operating systems are the main systems to test, but I deal with Windows Mobile testing on a regular basis as well. With this in mind, another difference between the desktop and mobile browsing worlds is the number of the devices themselves for the operating systems in both mobile device and tablet forms. In addition to mobiles and tablets, good test coverage will test various recent versions of the Android and iOS systems.



The number of operating systems, mobile devices, tablets and versions will obviously point to a huge bottleneck during the testing phase. No matter how quickly the test process can go, it will simply take time to test even small Drupal sites on so many devices, tablets, operating systems and versions. Fortunately, even though it may be in a premature state, mobile test automation can provide a solution by increasing the speed of the testing and quality assurance phase with tools such as Appium.

One advantage Drupal 8 has is that it appears to be compatible for mobile devices and tablets. Drupal 8 has a mobile guide that will show development processes for mobile environments (https://www.drupal.org/docs/8/mobile). In addition to the development processes in the Mobile Guide, the goal of this presentation is to give additional test tools to increase the speed of mobile device and tablet testing.

Mobile Test Automation Tools

Although most likely in their early stages of development, mobile test automation tools can help alleviate the testing bottleneck by using automation tools to increase the speed of the testing process. Test automation tests can be programmed using Selenium to quickly run numerous tests as often as desired in a number of Android and iOS devices.



Frequent Drupal 8 Mobile Bugs

In my experience in testing mobile devices and laptops, there are several issues that repeatedly appear:

• Image quality loss
• Cropping issues
• Text overruns
• Coding errors

My presentation will run through an automated test of a Drupal 8 site to show the testing code and how it interacts with modules and elements in the web page. Automated test solutions to the above problems involve script assertions and visual test automation.

Test Automation and Image Comparison

Test Automation scripts can be programmed to take screenshots of any system under test. Using visual test automation tools such as Applitools, PhantomCSS or Needle we can examine the screenshot and compare it to an exemplar image on a pixel-by-pixel basis to verify if the actual image screenshot matches the expected image.

Drupal is a registered trademark of Dries Buytaert.