DIY – Device lab

What to do during the COVID-19 pandemic… well I cleaned up my house and found some old phones that I wasn’t using anymore. 

I thought… what a waste! This machine power could be useful in some way. So hereby I introduce to you my device lab.

It consists of 6 different devices, mounted on a piece of fibreboard. I can control the devices via WiFi and for the time being, it will run my automated tests for an android app project. 

A few folks have asked how I set things up, and how I did it, so I figured I would write about it!

Device selection

For me this step was straightforward. I just grabbed all the phones that I’m currently not using and were lying around in some cupboard. Also as an android developer, I saved up some old android devices from previous jobs. 

But if you intend to also run automated tests, then considering looking at your analytics to understand what your users are using, and then regularly add new devices as the usage changes.

I luckily had a nice set of diverse devices that I could hang in booth orientations.

The Wall

This was quite a challenge since during the pandemic the hardware shops were closed. So I scrabbled some fibreboard and a wooden plank to create the outer wall.

To get the nice-looking pattern, I taped paper around the fibreboard and kept rearranging the devices until I got something that looked good.

Be aware of where the power outlet of the device is. Also, leave enough space between the devices!

I marked where the holes for the cables should be and started drilling. Then I started sticking them up. For this, I used sticky tape for now, but to be honest, this isn’t an ideal solution because some devices are too heavy for the tape to hold. So when the hardware shops are open again I’m getting myself some velcro!

After that, I stuck the wooden plank against it with another piece of fibreboard to create a box that could stand on its own.

Power management

I kept all of the devices powered via USB at all times so that the devices could keep the screens on and also didn’t have to worry about recharging things.

After a careful calculation of how much power each device was draining, I concluded that one Anker 40W 5-PortUSB should be enough to power my devices.


Now comes the interesting part. I didn’t want to plug the devices into my laptop each time I wanted to control them. Since they were all android devices I thought about rooting them to gain control over them via WiFi.

Some devices were super easy to root. I just downloaded the kingo app from their website and ran the rooting process.

Other devices had better security and it took way longer than expected to root them. Some steps were

  • Unlocking bootloader
  • Flashing a custom recovery
  • Flashing a custom kernel

Luckily, I used some pretty old devices like for example the Nexus 9 — so finding the right files to flash was easy to find. Please be careful with rooting your device if you don’t know what you are doing. You could brick your device. I followed most of the steps from the XDA forum.

I was unable to root Huawei devices since unlocking the bootloader requires a code that needs to be requested by Hauwei. I messaged them, but never got a response back. So I replaced the Huawei devices that I had with other Sony devices.

Automated testing

Since all devices were rooted it was time to gain control over them. Since I’m an android developer I already have Android Device Bridge (ADB) installed on my machine.

ADB is a versatile command-line tool that lets you communicate with a device. Next, I installed an app that enabled ADB to connect with the device over WiFi without using a USB cable to set up the connection.

Reminder, this is only possible with rooted devices.

Next, I grabbed an old android project on mine that had some automated tests writing down using the Espresso framework. Espresso is a tool to write concise, beautiful, and reliable Android UI tests. This android app includes three screens that do nothing, but it holds some good use cases for espresso tests. You can have a look here. For now, I could run the test against a device over WiFi! Almost there!

Android Studio doesn’t run tests in parallel. That’s a shame since I just mounted six devices on a wall. Luckily there is a tool called Spoon. Spoon runs the tests on multiple devices simultaneously. Once all tests have completed a static HTML summary is generated with detailed information about each device and test.

Final step

The only manual step here is that I need to connect those devices with ADB myself by typing adb connect <device ip address> in my terminal. I aimed to automate this as well as the final step.

To do this I first connected the devices with a static IP to the WiFi. This reassures me that my script I was about to create with the device IP addresses was always correct.

Then the script. I used Gradle as a build tool in my android app. So I created a task within gradle that loops over the IP addresses of the devices to do the adb command I described above. To finish it off I combined it with the Spoon task to run the tests in parallel!

Add a Comment

Your email address will not be published.