As a developer, designer or QA tester, we want to make sure the app or website that we are working on, looks and behaves flawlessly across all our users' devices and browsers.
While in the past, it was mostly necessary to do cross browser testing - nowadays we also have to make sure our website works on all the different mobile devices.
During development of your website or mobile app, you can easily verify and test your app on a mobile simulator (iOS) or emulator. Overall, these tools do a great job in making sure everything works as it should.
However, simulator or emulator testing alone isn't enough, you need to make sure your app works on devices that your users carry with them in their pocket.
This article describes how to set up a Mobile Device Lab.
What is a Mobile Device Lab
A Mobile Device Lab is usually a closet or table, filled with the mobile devices you want to test on.
In its most basic form, it's a closet where devices are scattered on the shelves, each connected to a power outlet and a wifi station.
If you intend to only do manual testing, then this kind of setup is usually sufficient.
However, some tweaks, which we'll describe further in this article, might also be helpful.
If you're looking to do automated testing, for example with Selenium and Appium, then please follow along.
Getting the devices
We recommend getting mobile devices from a trusted store selling second hand/refurbished devices.
Since these are only test devices, it doesn't really matter if the back of the phone has a scratch. In case of automated testing, we don't even care if the screen has a scratch, since we'll only look at the recorded video of the automated test, and not at the actual device screen.
This is where things get tricky; mobile devices run on batteries. If you intend to store a lot of devices in a rack solution, in some datacenter, then you need to take some things into account:
Batteries tend to overheat
Make sure you put devices on a metal shelve, since these devices get hot over time because of the battery and charging. The metal shelve will disperse heat better. Leave gaps between the devices, to make sure cool air flows between devices.
Over time, batteries degrade. A good solution for this is to invest in a good USB Hub. In a Mobile Device Lab we built, we're using a USB Hub from Cambrionix which automatically syncs and charges batteries according to the power profile of the device. This means devices will only charge when necessary, while still being synced to the host computer.
Monitor the battery levels of your devices. This is possible through ADB for Android or Instruments for iOS. Feed these into a monitoring solution to receive alerts when a battery goes bad.
Another good tip is to make sure the screen brightness of your devices is turned to the lowest level. This saves power and battery usage. Same goes for locking the screen; after each automated test, make sure to lock the screen so that the display is turned off. Leaving the display on will only draw more power and degrade batteries faster.
Connecting devices to a host computer
If you want do Automated testing, you'll need a computer that transmits the commands to the device. For iOS devices, this needs to be an Apple computer. We recommend a Mac Mini for this, it is cheap compared to other offerings, and has enough CPU and memory to handle a couple of iPhones or iPads.
To test apps on your iOS device, you'll need to install a provisioning profile connected with your host computer. This is a certificate from Apple that indicates your computer is allowed to install mobile apps on the device.
For Android testing, a cheap server can be used running Linux, for example an Intel NUC7i5. Make sure you install the latest Android SDK, authorise USB debugging between the device and the host computer, and you're all set to start automated testing.
This part is pretty easy; there's a very good open-source project available that does most of the heavy lifting, called Appium.
Simply install Appium on the host computer and after some minimal configuration steps, you will be able to point your tests to this Appium server.
Once you start a test, you will start seeing activity on the mobile device. This is Appium controlling the device.
After the test is complete, Appium can save a screen recording of the test on your computer.
This way you can see what the test actually did on the device.
Mobile Device Cloud
If you're not looking to invest time and money in setting up a Mobile Device Lab, there's an online service offering mobile device testing. Simply point the tests you've created to this service and indicate on which physical mobile devices you want to run your tests on.
After a test completes, you'll get access to useful information such as a screen recording, log files and performance metrics.