<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thibault Charriere on Medium]]></title>
        <description><![CDATA[Stories by Thibault Charriere on Medium]]></description>
        <link>https://medium.com/@thibault.charriere?source=rss-50a1b8b59e1f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_lsopwptJuHw5W3UQPkEng.png</url>
            <title>Stories by Thibault Charriere on Medium</title>
            <link>https://medium.com/@thibault.charriere?source=rss-50a1b8b59e1f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 23:04:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thibault.charriere/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[An in-depth look into running Android integration tests in our CI]]></title>
            <link>https://innovorder.dev/an-in-depth-look-into-running-android-integration-tests-in-our-ci-88eb1c1a681a?source=rss-50a1b8b59e1f------2</link>
            <guid isPermaLink="false">https://medium.com/p/88eb1c1a681a</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[mobile-development]]></category>
            <category><![CDATA[ci]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Thibault Charriere]]></dc:creator>
            <pubDate>Wed, 04 Aug 2021 16:59:47 GMT</pubDate>
            <atom:updated>2021-08-04T17:11:25.517Z</atom:updated>
            <content:encoded><![CDATA[<p>At <strong>Innovorder</strong>, our Android flagship product contains a lot of features. Since it has been designed to fully work offline, this product manages a massive database and relationships between models. Although we had previously written end-to-end tests, we felt the need for us to have more confidence in writing new features without breaking the many existing ones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*6jTpIjrtEoA2sq54JkqYYQ.jpeg" /></figure><blockquote><em>Testing helps decrease the general risk level in the system as a result of detecting defects and debugging. It also provides confidence in the software quality.</em></blockquote><p>Naturally, we decided to write integration tests as a viable solution for this issue, and we started by running them locally on our machines. But two significant issues arose :</p><ul><li>We need to run the tests on multiple devices. This is very time-consuming to set up and uses a lot of CPU resources, slowing down your work.</li><li>A lot of our testing is done by product managers that don’t use Android Studio on a daily basis.</li></ul><p>Therefore we all agreed that we would need to be able to run our integration tests in our CI through a platform that would enable us to run them manually. There are two types of solutions: <strong>cloud-based device farms</strong> or <strong>emulators running in a VM</strong>.</p><p>To run Android Instrumentation tests, they must be directly run on a device, physical or emulator. All of the latest android images for emulators are now x86 or x86_64 and therefore need <strong>hardware acceleration (KVM)</strong> support from the host VM.</p><p>So we decided to try out three different solutions:</p><ul><li><strong>Running a VM in Google Cloud Build.</strong></li><li><strong>Using the Amazon Device Farm.</strong></li><li><strong>Using Github Actions.</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*8DIBEs1YciUtm0cWrcIeoQ.png" /></figure><h3>How did we put this in place?</h3><h4>Google Cloud Build</h4><p>Since the rest of our CI is built on <strong>Google Cloud Build</strong> (GCB) to build and deploy our apps, the first step was to run the integration tests within the <strong>GCB</strong> ecosystem. This means three things :</p><ol><li>Building and running a docker image with a running Android emulator inside;</li><li>Starting the emulator and running the tests in this image;</li><li>Exporting the results of the tests to somewhere with easy access;</li></ol><p>The first step is where the issue lies: building a docker image with the Android ecosystem in it is quite trivial but having a functional emulator is not. This issue is that all android images since API level 25 require <strong>hardware acceleration</strong> to run. This means you have to add all the necessary libraries to run this in your docker image.</p><p>This is a real hassle and means that you are going to have to build a very large docker image (with the Android SDK you are well above 10GB storage). So this solution is very costly and simply didn’t feel like the best path to go down.</p><h4>Amazon Device Farm</h4><p>This solution was only considered because we realized it didn’t meet our needs. At <strong>Innovorder</strong>, we only use a small number of very specific tablets designed to be Points of Sale (POS) and the devices available in the <strong>Amazon Device Farm</strong> didn’t have the general specs that we required.</p><p>Also, given the use that we would have for it, the pricing of this solution isn’t what we are looking for, this is clearly dedicated to much larger companies testing on more common devices.</p><h4>Github Actions</h4><p><strong>Github</strong> has added support for CI/CD for a while now. A very interesting fact about the hosting <strong>Github</strong> machines: the <strong>Linux</strong> host machines do not have KVM enabled. So you would have to build your own docker image and we would be back at square one. <strong>However, the macOS machines</strong> have HAXM installed and enabled, <strong>HAXM</strong> (Hardware Accelerated Execution Manager) being the macOS equivalent of KVM.</p><p>After a little digging, I found a prebuilt custom <strong>Github Action</strong> that does all of the docker image creation with the emulator that runs smoothly:</p><p><a href="https://github.com/marketplace/actions/android-emulator-runner/">Android Emulator Runner — GitHub Marketplace</a></p><p>After some digging and research I finally ended up building my own Github workflow with the following Yaml script to run the action :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/889ff31089285745014570244239db05/href">https://medium.com/media/889ff31089285745014570244239db05/href</a></iframe><p>A couple of things that need to be explained. First the emulator-build . This comes from an issue that arose from Android builds running on the macOS version. Since we are using macos-latest this runs on macOS version 10.15. There is an issue with running emulators on this macOS version and <a href="https://github.com/ReactiveCircus/android-emulator-runner/issues/160">given this issue:</a> there were two workarounds :</p><ul><li>Running the tests on macOS 11 (but you need a special Github plan for that).</li><li>Setting an older emulator build id for the booting to complete.</li></ul><p>We used the API level 26 because that represents the majority of our devices but we’ll see later that you can actually test several API levels at the same time if needed.</p><p>For now, we choose to launch the tests manually, but since our code is stored in Github, one could use Webhooks to launch the tests whenever you merge your code into specific branches.</p><p>Finally, a small addition was to upload the tests reports when the tests have run their course so that non-developers can come to the GitHub Actions and check the tests results through the standard Android HTML view mode.</p><p>Here is a glimpse of what it looks like to run the tests :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hAAfYEhm-mpKvA_Ff2m5gA.png" /></figure><h3>Future optimisations</h3><h4>Caching</h4><p>One of the major drawbacks of using this method is that simply running the emulator before running any test takes roughly 15 minutes in order to rebuild the emulator every time. So your total test run time will be at least 18–20 minutes. To counter this you can reduce emulator startup time by setting up AVD snapshot caching.</p><p>You can simply add this snippet before running your tests :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f29af14c37124dfc660d5bd79cffdcc7/href">https://medium.com/media/f29af14c37124dfc660d5bd79cffdcc7/href</a></iframe><h4>Build Matrix</h4><p>If you want to run your tests on multiple android versions and/or architectures you can use the Github Actions build Matrix. This can be very practical if you still have a lot of old Android versions your app can run on especially since that can be a major source of issues (that we have encountered !). You can define a strategy as follows :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9eac229176612effa8f20cd7122306cf/href">https://medium.com/media/9eac229176612effa8f20cd7122306cf/href</a></iframe><h3>Google is at it too</h3><p>As per their <a href="https://developer.android.com/studio/preview/features?hl=fi#bumblebee-testing">new release notes for the latest Android Studio Bumblebee</a>, you can see the Android teams are working on improving the stability of instrumentation tests.</p><p>Hopefully, all you need now is to write your tests and you’re ready to go</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*xIxMtmgYuiKMPre_4_2tkw.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88eb1c1a681a" width="1" height="1" alt=""><hr><p><a href="https://innovorder.dev/an-in-depth-look-into-running-android-integration-tests-in-our-ci-88eb1c1a681a">An in-depth look into running Android integration tests in our CI</a> was originally published in <a href="https://innovorder.dev/">Innovorder Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>