DEV Community

Cover image for Running Android Instrumented Tests on CI - from Bitrise.io to GitHub Actions

Running Android Instrumented Tests on CI - from Bitrise.io to GitHub Actions

Yang on November 24, 2019

It's almost 2020 and it remains a challenge to run Android Instrumented tests on CI, especially for opensource projects and small teams: Setting ...
Collapse
 
iryo400 profile image
Akbolat Sadvakassov

Hi! Thanks for such deep tutorial. It's helpful for beginners in CI like me
What do you think, is there any other way to write tests for Room's Dao classes? Actually I don't have any other instrumented tests for now.
Thanks!

Collapse
 
ychescale9 profile image
Yang

You mean running those DAO tests as regular unit tests that can be run on the host machine without an emulator / real device?

You could try Robolectric, or look at sqldelight which supports using an in memory Sql driver for unit tests. Here’s an example.
Hope that helps!

Collapse
 
istrateandrei profile image
Andrei Istrate

Thanks for the insight!

Was wondering, is there a way to specify a different emulator port when using reactivecircus/android-emulator-runner@v2 ? I keep getting error: could not connect to TCP port 5554: Connection refused when running my job in a self-hosted runner.

This works perfectly fine on macos-latest but my repo is private and I'm trying to minimise my costs.

Collapse
 
michallaskowski profile image
Michal Laskowski

Hey. Thanks a lot. This really helped me to setup instrumented tests on my project, which is all about tests in Espresso and XCUITest. And yeah, it works great with GitHub Actions: github.com/michallaskowski/kuiks/p...

Collapse
 
ychescale9 profile image
Yang

Glad it helped!
By the way I also wrote a ui testing library based on espresso. Feel free to take whatever you may find useful for your KMP project.

Collapse
 
istrateandrei profile image
Andrei Istrate

@ychescale9 When running on a self-hosted macOS runner that has M1 chip, what setup changes we have to do?