Testing on the CI

  1. Starting an emulator in your CI
  2. Using a cloud-based test infrastructure provider, such as Firebase Testlab (https://firebase.google.com/products/test-lab )
  3. Running your own server, connecting devices to it, and running the tests on them.
  1. Involves easy setup, especially where your CI solution provides massive support for it. For example, with Bitrise, you can just use a dedicated step to do it, the AVD Manager step. The downside is that the performance of such virtual devices are usually worse than running the tests on an actual device or on your local machine.
  2. This is also relatively easy to set up and similarly to the option above, Bitrise supports it with the Virtual Device Testing For Android Step. This does provide better performance, but it is more cumbersome to access the devices themselves, and will cost additional money if the free plan does not suit your needs. Still, you will be able to choose from a wide variety of devices, what otherwise would be really expensive to buy them for yourself.
  3. This solution can provide a very good performance, but as you might guess, you have to invest in it, buy the required hardware, and create the required infrastructure for it. This could be difficult and risky, not to mention that you have to maintain it as well. I would recommend this only, if you have a really strong reason to not to go with option 1 or 2.

How to effectively run a virtual device on your CI?

1. Time is money

2. Discover issues early

exec {
commandLine("bitrise", "validate")
}
// Create the task
task validateCiConfig() {
exec {
commandLine("bitrise", "validate")
}
}
// Make sure the project has been evaluated
afterEvaluate {
// Get the tasks
Task taskWhatIamLookingFor = tasks.findByName("nameOfTheTask")
Task validateCiConfigTask =
tasks.findByName("validateCiConfig")
// Add the dependency on the task
taskWhatIamLookingFor.dependsOn(validateCiConfigTask)
}

3. Test results are not everything

mkdir -p /bitrise/src/my-application/build/reports
adb logcat -d > $BITRISE_SOURCE_DIR/my-application/build/reports/logcat.txt

Summary

--

--

--

Professional software engineer and Scrum master

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Real-time lifecycle-aware updates in Jetpack Compose

Adding FB login into your Android app

Clean Empty Jetpack Compose App Template

What else Dagger 2 injection provides?

Walk through hell with Android StrictMode

Sometimes it takes a little more time

Android: Error handling in Clean Architecture

Android Kotlin Custom Navigation Drawer or Slider Navigation Drawer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Richárd Bogdán

Richárd Bogdán

Professional software engineer and Scrum master

More from Medium

HarmonyOS: Basic Features of Lite Wearable APIs

Intermediate: Find Doctor Near to Me using Huawei Kits (Account, Crash and Analytics) in Android…

Find Log in via SMS and Forgot password?

CI-CD: Install Nexus to Local Machine