How to use Gradle Managed Devices with your own devices
<p>Google recently introduced a new feature for Android Gradle Plugin, Firebase Test Lab for Gradle Managed Devices. It uses Gradle Managed Devices API to launch tests not on the same machine where Gradle runs, but on a remote virtual or physical device inside Firebase Test Lab (paid feature). In this article, we’ll cover its functionality, how we can use our own device farm to launch tests remotely in the same manner as Firebase Test Lab does, and parallelize execution between multiple devices.</p>
<h1>Gradle Managed Devices</h1>
<p>Initially, Gradle Managed Devices was released to delegate a process of creation, launching, and closing emulators to Android Gradle plugin.</p>
<pre>
android {
testOptions {
managedDevices {
devices {
register("pixel2api30", com.android.build.api.dsl.ManagedVirtualDevice) {
device = "Pixel 2"
apiLevel = 30
systemImageSource = "aosp"
}
}
}
}
}</pre>
<p>By using the configuration above, we’re able to launch UI tests via <code>pixel2api30Check</code> task, and don’t need to connect a device or launch an emulator before running it. The environment of this test run is the same across different machines.</p>
<h1>Firebase Test Lab</h1>
<p>Firebase Test Lab for Gradle Managed Devices is a new feature, recently presented at Android Dev Summit 2022. This means that we can now run UI tests in Test Lab directly from Gradle, and don’t need to use command line tools or web UI.</p>
<p><a href="https://medium.com/bumble-tech/how-to-use-gradle-managed-devices-with-your-own-devices-750d6709552d">Website</a></p>