How to create your own Mobile Device Lab for Automated Testing

Jochen
2 min readAug 19, 2019
real device testing

You’ve written a couple of Selenium tests and you want to run these with Appium on a physical iOS or Android device instead of a simulator or emulator?

Host Computer
The first thing you’ll need is a physical device; an iPhone, iPad, Android phone or tablet.
Next, you’ll need a host computer that will send the test instructions to the device.
For iOS, this should be an Apple computer (Mac Mini for example), since iOS will need XCode to run tests.
For Android, this can be any kind of computer, even a Raspberry PI could do the trick.

Software
On the software side, you’ll need to setup Appium. This is pretty straightforward, simply install the software and Appium will automatically detect your iOS/Android device(s).
Some other configuration is needed on the device as well. Appium’s documentation has a list of things that need to be configured.

You now have a node ready to run your tests. Simply change your test configuration to connect to this node. The node will receive the test request, setup and connect to the device and run the test on the device. As your test runs, you can see the device automatically opening an app or browser, performing actions and closing the browser or app.

Once your test completes, you’ll see if it succeeded or failed.

Cost
Setting up your own Device Lab can be pretty expensive, especially if you want to test on high end devices.

Some tips on saving money with the Device Lab:
- The devices you purchase can be second-hand phones, they can even have scratches or a broken screen, since these devices will only be used for testing.
- Buy 1 powerful host computer instead of multiple smaller ones, run multiple VMs on the host computer.
- Make sure your devices have their screen brightness set to the lowest level, to save on electricity.
- After each test, instruct your device to turn off its screen, to save on battery lifetime and electricity.
- Consider purchasing an advanced USB hub that does automatic charging and syncing, depending on the power profile detected for the device. (Cambrionix PowerPad for example)

The good news is that multiple companies on the internet provide this service already. So instead of setting up and maintaining everything yourself, why not outsource this to a cloud company. TestingBot for example offers a real device cloud, ready to run your tests. All you need to do is configure your tests to connect to the TestingBot grid, and the devices in the grid will run the tests you’ve written. You get instant feedback, together with screenshots, a video and test logs.

--

--