<?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 cenci7 on Medium]]></title>
        <description><![CDATA[Stories by cenci7 on Medium]]></description>
        <link>https://medium.com/@cenci7?source=rss-e5057863ecba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*xqx6MXghGjdYOUHQ_UNIxA.png</url>
            <title>Stories by cenci7 on Medium</title>
            <link>https://medium.com/@cenci7?source=rss-e5057863ecba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 21:30:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@cenci7/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[How to write less code in tests]]></title>
            <link>https://medium.com/mercadona-tech/how-to-write-less-code-in-tests-a5f8d556194e?source=rss-e5057863ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/a5f8d556194e</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ui-testing]]></category>
            <dc:creator><![CDATA[cenci7]]></dc:creator>
            <pubDate>Tue, 24 Oct 2023 07:31:35 GMT</pubDate>
            <atom:updated>2023-10-24T07:31:35.353Z</atom:updated>
            <content:encoded><![CDATA[<p>One year ago we started trying <a href="https://maestro.mobile.dev/">Maestro</a>. It’s a game changer for the UI tests!</p><p>As our UI tests were a mess, we got encouraged to try it. The results for the first use case were impressive: <strong>we reduced from more than 260 lines to just 21,</strong> <strong>almost 92% less!</strong></p><blockquote>It’s well known that the fewer lines of code, the fewer the errors.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*F2W5fhkxsG5lnKkH" /><figcaption>Photo by <a href="https://unsplash.com/@ahmad_elsafty?utm_source=medium&amp;utm_medium=referral">ahmad elsafty</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>To add more context to the article, I will focus on this use case: Our drivers have to input the center, their driver ID, the route and the expedition lane, and also the plate of the vehicle to log in to our Delivery App.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*dng_TbuxrWURGVBOY87jPg.gif" /></figure><h3><strong>What we had before</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*OzvPKgrskV0RB9iUbvvJOg.png" /></figure><p>We had some layers in our testing framework:</p><ul><li><a href="https://developer.android.com/training/testing/espresso">Espresso</a>: Google’s framework for UI testing. Allows to write things like this:</li></ul><pre>onView(withId(R.id.etDriver)).perform(typeText(&quot;1007&quot;))</pre><ul><li><a href="https://github.com/AdevintaSpain/Barista">Barista</a>: Built on top of Espresso, it provides a simple API, removing most of the boilerplate of common Espresso tasks.</li></ul><pre>BaristaEditTextInteractions.writeTo(R.id.etDriver, &quot;1007&quot;)</pre><ul><li>Custom functions: a bunch of Barista actions grouped to give them more semantics.</li></ul><pre>fun doLoginWithRouteAndPlate() {<br>    selectCenter()<br>    enterWithDriver(DRIVER_ID)<br>    allowPermissionsIfNeeded(Manifest.permission.READ_PHONE_STATE)<br>    enterWithRouteAndLane(ROUTE_WITH_NO_PLATE_ID, LANE_ID)<br>    enterWithPlate(VEHICLE_PLATE)<br>}</pre><ul><li>A custom class to allow us write things like this and improve the readability. Big clap for my mate <a href="https://medium.com/u/cf9e436bd27c">Edgar Miró</a>, this was a huge achievement!</li></ul><pre>@E2eTest<br>class LoginE2eTest : BaseE2eTest() {<br><br>    @Test<br>    fun login() {<br>        AppLaunched<br>            .then(LoginScreen) {<br>                doLoginWithRouteAndPlate()<br>            }<br>            .then(OrderListScreen) {<br>                assertHasNavigatedToIt()<br>            }<br>    }<br>}</pre><h3>What we have now</h3><pre>appId: es.mercadona.our.delivery.app<br>---<br>- clearState<br>- launchApp<br><br>- assertVisible: &quot;Buscar por número de centro&quot;<br>- inputText: &quot;4447&quot;<br>- tapOn: &quot;Colmena Valencia&quot;<br><br>- inputText: &quot;1007&quot;<br>- tapOn: &quot;Siguiente&quot;<br><br>- inputText: &quot;74476&quot;<br>- tapOn: &quot;Calle de expedición&quot;<br>- inputText: &quot;1&quot;<br>- tapOn: &quot;Siguiente&quot;<br><br>- tapOn: &quot;Matrícula&quot;<br>- inputText: &quot;4321BUM&quot;<br><br>- assertVisible: &quot;Ruta 74476 / Calle 1&quot;</pre><h3>Comparison</h3><p>Before:</p><ul><li>Need some libraries.</li><li>A lot of lines of code.</li><li>Only we (the android engineers) had the knowledge of how to write tests.</li><li>Poor readability (remember that we have to create our custom class to make it more readable).</li></ul><p>Now:</p><ul><li>No libraries needed.</li><li>Very few lines of code.</li><li>The whole team is able to write a test.</li><li>Best readability by far.</li><li>Big Slack community where ask for help when needed and request new features.</li><li>It’s <a href="https://github.com/mobile-dev-inc/maestro">open source</a> , and they make releases quite often.</li><li>We could share the same tests between Android and iOS if the UI is the same.</li></ul><h3>Conclusion</h3><p>Even so, if I had to say one bad thing, it would be that they deprecated the mocking network feature. It allowed us to make our tests faster and more independent. Now, we must wait until our backend app is up locally and start our tests suite.<br>Although on the other hand, we found a workaround:</p><ul><li>Launching our UI tests with the server response mocked with <a href="https://www.mocks-server.org/">Mocks Server</a> (and not via Maestro).</li><li>Keep the coverage between server and client implementing <strong>contract tests</strong>, but this is <a href="https://medium.com/mercadona-tech/contract-tests-a-new-hope-e2df7470e118">another article</a> 😉</li></ul><p>As always in life, we learn by doing, and we have our own tricks right now and you? Have you tried Maestro? Share your thoughts in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a5f8d556194e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mercadona-tech/how-to-write-less-code-in-tests-a5f8d556194e">How to write less code in tests</a> was originally published in <a href="https://medium.com/mercadona-tech">Mercadona Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time is precious. Waste it wisely.]]></title>
            <link>https://medium.com/mercadona-tech/time-is-precious-waste-it-wisely-a4a426baa796?source=rss-e5057863ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4a426baa796</guid>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[android-testing]]></category>
            <category><![CDATA[sharding]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <dc:creator><![CDATA[cenci7]]></dc:creator>
            <pubDate>Fri, 26 Aug 2022 06:31:10 GMT</pubDate>
            <atom:updated>2022-08-26T06:31:10.651Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IBqVO0z_7myZ1i4lwaNR9g.jpeg" /></figure><p><strong>Time is precious, and there’s no doubt here.</strong> We all like to wait as little time as possible for something. We all want to control our time. And that’s the purpose of this article: to promote knowledge sharing and encourage you to share your practices with us.</p><p>Here at Mercadona, we have CI/CD in our projects. We run our pipelines when we open a PR and merge to master when we deploy a new version…</p><p>Let’s focus on the last point: reducing our pipeline time means a lower waiting time for deploying a new version.</p><p>The less waiting time, the more we will be willing to deploy frequently. And <strong>deploy more frequently means our deployments would be smaller and safer</strong> (as we talk in this article about <a href="https://medium.com/mercadona-tech/how-we-achieve-continuous-deployment-in-a-native-app-1156abf5f856">continuous deployment</a>). <strong>It sounds like a huge benefit!</strong></p><p>If you work with some automated tasks, I’m pretty sure you’re tired of waiting for them to finish, and so we are. That’s why, from time to time, we rethink our processes and challenge ourselves to reduce our pipeline time, no matter how small change gets implemented.<br>Even if you save 10 seconds, it’s worth it. The more you run the pipeline, the more time gets saved.</p><p><strong>And here’s where our story begins:</strong> <a href="https://medium.com/mercadona-tech/reduce-ios-ci-time-using-test-parallelization-de949a80fc5f"><strong>trying to imitate our iOS mates</strong></a>. They saved a massive amount of time running their tests on different devices simultaneously.</p><p>Thanks to our mate Voro we started to research if there were something similar in android, and we started from <a href="https://developer.android.com/training/testing/instrumented-tests/androidx-test-libraries/runner#shard-tests">here</a>.</p><h3>What did we have?</h3><ul><li>Some scripts to initialize our backend API in our local environment.</li><li><a href="https://fastlane.tools/">Fastlane</a> and its plugin <a href="https://rubygems.org/gems/fastlane-plugin-automated_test_emulator_run/versions/1.6.0">to create the AVD</a> (Android Virtual Device) where we run the instrumentation tests.</li><li>A list of one AVD configuration:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5f3718a49d0f595a8e07277cca51c613/href">https://medium.com/media/5f3718a49d0f595a8e07277cca51c613/href</a></iframe><ul><li>Our tests with <a href="https://github.com/AdevintaSpain/Barista">Barista</a>.</li><li>A stage in our Jenkins pipeline which lasted around 12 minutes.</li></ul><h3>What did we want?</h3><p>Thanks to our tests being independent, we wanted to split them to run in parallel to <strong>reduce our pipeline time</strong>.</p><h3>What did we do?</h3><p>Obviously, searching on the Internet. And, of course, <strong>with that feeling of having no idea of where we were going. </strong>We started to work together, <a href="https://medium.com/@edmiro">Edgar</a>, Voro, and me, during a week or so, and taking some snippets we were finding and mixing them like a tailor, we came something that seemed a good solution.</p><p>Now we were able to run tests in parallel, but what could be the correct number of AVDs? We started with two, and the time was reduced from 12 mins to 10 and a half. We made another attempt with three AVDs and the time decreased to 8 and a half. Just out of curiosity, we tried it with four, but surprisingly the time was more or less the same as with three, so we considered three the right number of AVDs.</p><p><strong>We reduced the time of the tests by almost 4 minutes (20–30% less than before)!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/933/1*YO7c4soBt0AWsK3x27pEaQ.png" /><figcaption>Message from our mate Edgar to share our successes with the rest of the Engineering team</figcaption></figure><p>📽 And here’s the video, just in case you want to see it.</p><p><a href="https://drive.google.com/file/d/10g3od77NbwGPmOEuYJHC4h0rhrqhtsEB/view?usp=sharing">Parallel Android e2e testing.mov</a></p><h3>What do we have now?</h3><p>First of all, we have to add more AVDs to our list. As we didn’t want to change our configuration, we just copied and pasted what there was and changed the name and the port:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc3c763d60b23ff8ad0acd6fa312df88/href">https://medium.com/media/cc3c763d60b23ff8ad0acd6fa312df88/href</a></iframe><p>Next, we created a script to start all the emulators from the command line:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b57b875192e0a8d3687b860a02e3759d/href">https://medium.com/media/b57b875192e0a8d3687b860a02e3759d/href</a></iframe><p>We create another script for launching the tests. As you can see in the gradle command ./gradlew :app:connectedE2eDebugAndroidTest ,we have a buildType debug and a productFlavor e2e (you can replace them with yours):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7684b077befd77aa90d2c8d86ea3f4fe/href">https://medium.com/media/7684b077befd77aa90d2c8d86ea3f4fe/href</a></iframe><p>After that, we joined our scripts to initialize our backend API in our local environment with the new ones:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a879dfb4df67f3b14e8cbfe852eb1e97/href">https://medium.com/media/a879dfb4df67f3b14e8cbfe852eb1e97/href</a></iframe><p>Finally, we changed our lane in our fastfile, and it looks pretty well!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a2770238bb6f3148e3901881611a1e12/href">https://medium.com/media/a2770238bb6f3148e3901881611a1e12/href</a></iframe><h3>Next steps and conclusions</h3><p>We want to understand the criteria for sending a test to a specific device. If you have seen the video, in the end, there’s only one device running tests; meanwhile, the other two are idling.</p><p>Surely we can improve our scripts to reduce the number of lines. For instance, we could read our AVD list file instead of having them in the emulators variable.</p><p>And also, we would like to try other actions to reduce our total pipeline time, such as splitting the code into different modules to reduce the building time.</p><p><strong>Every second counts! Have you ever stopped to rethink and analyse every stage in your pipeline? How do you save time in your automated tasks?</strong></p><p>I’ll be glad to read your tricks in the comments, or even better, and maybe you want to join us to face these problems? <a href="https://www.linkedin.com/jobs/search/?currentJobId=3202109795&amp;f_C=28956298&amp;geoId=105646813&amp;keywords=mercadona%20tech&amp;location=Spain&amp;refresh=true">We are hiring!</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4a426baa796" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mercadona-tech/time-is-precious-waste-it-wisely-a4a426baa796">Time is precious. Waste it wisely.</a> was originally published in <a href="https://medium.com/mercadona-tech">Mercadona Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I’m scared: I have to evaluate my manager]]></title>
            <link>https://medium.com/mercadona-tech/im-scared-i-have-to-evaluate-my-manager-b68230bd119d?source=rss-e5057863ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/b68230bd119d</guid>
            <category><![CDATA[performance-reviews]]></category>
            <category><![CDATA[software-engineer]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[extreme-programming]]></category>
            <category><![CDATA[feedback]]></category>
            <dc:creator><![CDATA[cenci7]]></dc:creator>
            <pubDate>Fri, 05 Nov 2021 10:37:51 GMT</pubDate>
            <atom:updated>2021-11-05T10:37:51.299Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello everyone, my name is Luis and I’ve been part of Mercadona Tech since April 2018 as a software engineer. But this story starts more or less one year and a half after my arrival.<br>It all began in June 2020, when I had to evaluate my manager’s evolution last year, and I felt totally lost.</p><p>In this article I’d like to share how I faced that process and how <strong>we created a framework to help other teammates</strong> do it in a valuable way for our managers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9gzOEPH4wtwCaR0w" /><figcaption>Photo by <a href="https://unsplash.com/@bdchu614?utm_source=medium&amp;utm_medium=referral">Brendan Church</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In Mercadona Tech, we officially receive a performance review from our manager at the end of the year. Still, usually, we have two performance reviews per year (among many other 1:1 meetings). We analyze the last 12 months and see which points may need improvement to help us keep growing.<br>We were asked to do the same to our manager at midyear, and here the problem arose. I was concerned about not being good enough doing that. <strong>It’s not easy to tell somebody things to improve and even less to your manager!</strong></p><p>For more than a year, he was my manager, and I felt comfortable talking to him; that wasn’t the problem. The problem was that he was helping me a lot to grow up, and I had the opportunity to return that help, but I had no idea where to start. Well, to be honest, I had one clue, some teammate had shared <a href="https://docs.google.com/forms/d/e/1FAIpQLSdTeBHKoI3784y7xsT_-Mh2jhlbW1NXR5McNuhUiCzhGSCWMw/viewform">this form</a> from ReWork, but it wasn’t enough.</p><p>When I returned from my summer holidays, I told other managers about my concern and asked them for their feedback. They told me that their reviews weren’t as helpful as they would have liked, which surprised me. <br>I then realized that I wasn’t alone, and we formed a small task force to think about how to improve the process and make all those reviews valuable.<br>We started gathering some feedback from my mates about how they faced the performance review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bmx5MkxlWjQ7TnGc" /></figure><p>Once we had some feedback about the rest of the team, we found that some had the same fears. However, other ones had some beneficial articles or techniques to do a good performance review.</p><p>After some meetings with the task force, we did a personal-thinking exercise to answer three critical questions about the review:</p><ul><li>What do you expect from it?</li><li>Why is it needed?</li><li>What strategies do you follow?</li></ul><p>Everyone in the task force answered those questions and we met again to discuss all that information we had.<br>We all agreed that a bullet-point document would focus on the essential things.</p><p><strong>After a couple of months iterating, finally, we arrived to our guide to evaluate our manager’s evolution, and here it’s:</strong></p><h3>Why a Performance Review?</h3><p>The Performance Review is one of the many tools we use at Mercadona Tech to give feedback constructive to our managers. This feedback is necessary to seek challenges that make us better professionals and enhance the things we do well. When we review our managers, we can help them improve in the same way that they help us in our reviews. In the case of managers, they are measured by the support they give to their collaborators, so by assisting them to be better, we help them give us better support. Everybody wins.</p><h3>What parts does the Performance Review have?</h3><p>It should review the evolution concerning the previous review (if any) and analyze whether or not everything that we set out to do has been achieved. In addition, a good review should look back on the points where our manager stands out the most and those where they can improve - the more detailed, the better.</p><h3>Tips for writing a good Performance Review</h3><ul><li>Try to be objective and remember that you only see part of your manager’s performance.</li><li>Be concrete. Use data, details, examples… to support your recommendations. <a href="https://www.mindtools.com/pages/article/situation-behavior-impact-feedback.htm">The SBI (Situation-Behavior-Impact) framework</a> is handy: Describe the situation, describe the behavior and communicate the impact it has had on the whole team or us.</li><li>Write things down monthly to be ready in the following review.</li><li>Be honest and sincere to avoid surprises. The 1:1s should be a place to share feedback bidirectionally with a higher frequency than the performance reviews.</li><li>The recommendations must have a possibility associated solution or at least how we would have faced that situation. An improvement point without an alternative solution is not an improvement point; it is a complaint.</li></ul><h3>Manager role</h3><p>To make an objective, data-based assessment, you must understand their role and their related responsibilities.</p><ul><li>Is a good coach: guides, mentors, supervises and supports you to achieve better results,</li><li>Challenges you and gives feedback,</li><li>Increases the value of the team,</li><li>Knows every member and ensures an inclusive environment throughout the team,</li><li>Communicates instructions and listens to your feedback,</li><li>Helps you develop your skills,</li><li>Their vision and strategy make the team row in the same direction,</li><li>You see them as a technical reference,</li><li>Makes good decisions taking into account the opinions of the team</li></ul><h3>Review template</h3><p>Here are some questions that may help you to write a valuable performance review. Maybe you have some other ones. If so, I encourage you to write them in the comments :)</p><h4>Answer with a few words</h4><ul><li>What would you recommend them to continue doing?</li><li>What would you recommend changing their management?</li><li>Give an example of a situation where your manager helped you to improve your performance. How does it help you to improve?</li><li>Write the three qualities that best define your manager.</li><li>How do they keep the team focused on results and priorities?</li><li>How do they show you the value you bring to the team?</li><li>Do you feel that your manager does “micromanagement”? What do you think should improve to make you feel more autonomous?</li><li>How does your manager motivate you?</li></ul><h4>Answer with yes / no</h4><ul><li>My manager shows consideration for me as a person.</li><li>My manager regularly shares relevant information from their manager and top leaders.</li><li>My manager has discussed my professional development with me in the last six months.</li><li>My manager has the experience to guide me when I have a problem.</li><li>My manager is someone I can trust.</li><li>Are the objectives that your manager communicates to you clear?</li></ul><h4>On a 0–10 scale, how satisfied are you with the frequency of communication you have with your manager?</h4><p>— — — — — — — — — — — — — — — — — — — — —</p><h3>Conclusions</h3><p>After reading many articles, asking my teammates, and sharing some techniques with other managers, I’ve understood how important feedback is, especially from bottom to top.</p><p>As I empathize more with the manager position this past summer, I felt quite comfortable doing the performance review, and overall, I did a pretty valuable feedback interview. And I’m sure the rest of the team has improved their reviews as well.<br><strong>Win-win!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6HfKoKBSJ6wvIhvN" /></figure><p><strong>Never forget that we are part of an XP team, and everything we do is feedback loops.<br>Take care of them!</strong></p><p>Finally, to share those guidelines, we added them to our onboarding process to be helpful for new members. Even though we have it in a private document, our idea is to make it public to the community… So stay tuned for it!</p><h3>Some References</h3><ul><li><a href="https://www.radicalcandor.com/direct-reports-radical-candor-feedback/">Radical Candor</a></li><li><a href="https://www.mindtools.com/pages/article/situation-behavior-impact-feedback.htm">The Situation-Behavior-Impact framework</a></li><li><a href="https://flopezluis.medium.com/">Félix López blog</a></li><li><a href="https://qz.com/1058760/manager-feedback-at-google-employees-are-asked-13-questions-about-their-bosses-as-part-of-a-semi-annual-review-goog-googl/">The 13 questions Google asks about its managers when it gathers employee feedback</a></li><li><a href="https://docs.google.com/forms/d/e/1FAIpQLSdTeBHKoI3784y7xsT_-Mh2jhlbW1NXR5McNuhUiCzhGSCWMw/viewform">re:Work — Manager Feedback Survey</a></li><li><a href="https://github.com/VGraupera/1on1-questions">1on1 questions</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b68230bd119d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mercadona-tech/im-scared-i-have-to-evaluate-my-manager-b68230bd119d">I’m scared: I have to evaluate my manager</a> was originally published in <a href="https://medium.com/mercadona-tech">Mercadona Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How we achieve Continuous Deployment in a native app]]></title>
            <link>https://medium.com/mercadona-tech/how-we-achieve-continuous-deployment-in-a-native-app-1156abf5f856?source=rss-e5057863ecba------2</link>
            <guid isPermaLink="false">https://medium.com/p/1156abf5f856</guid>
            <category><![CDATA[automation-software]]></category>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[teamwork]]></category>
            <category><![CDATA[native-app]]></category>
            <dc:creator><![CDATA[cenci7]]></dc:creator>
            <pubDate>Fri, 02 Jul 2021 12:05:25 GMT</pubDate>
            <atom:updated>2021-07-02T12:05:25.144Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XMqmpjU40asipOqQMVPcBw.jpeg" /></figure><p>In this article I’d like to share my experience over the last months, more specifically since last October, when we challenged ourselves to achieve a continuous deployment workflow in a native app; a feat which we finally achieved a month ago. Now we have a release process that is both safer and faster!</p><p>First of all let me introduce myself and what I do: my name is Luis and I’m a software engineer at Mercadona Tech. Since October 2019 I’ve been working on Deliverapp, the app our drivers use to make the delivery process easier. With the app our drivers can see the list of orders they have to deliver as well as performing various other actions: navigating to an order’s address in Google Maps, scanning an order’s labels to ensure the products being delivered are the correct ones, or reporting an incident to ACMO (Atención al Cliente de Mercadona Online).</p><h3>First steps: Release Trains</h3><p>In the beginning I followed the same strategy as we had in the <a href="https://play.google.com/store/apps/details?id=es.mercadona.tienda">Shop application</a>. Every two weeks we prepare and release a new version. This strategy is quite well explained in this talk by<a href="https://vimeo.com/showcase/7769418/video/479964923"> Antonio Escudero</a>.</p><p>But there was a big difference between the two apps: Shop was public and DeliverApp was for internal use (our only users would be our drivers). So the Shop app was released to Google Play whereas DeliverApp was released to a bucket in our Google Cloud Storage, something which allowed us to avoid Google validations and deliver faster.</p><p>Once we validated that model and we felt comfortable with it we decided to move on and make releases every Monday. We were able to deliver more value and receive feedback earlier (<a href="https://youtu.be/DSxFvswXjy0?t=1242">feedback loops as a lifestyle</a> as our CTO Fernando Díaz repeats over and over again).</p><p>To ensure a low-impact release we followed a phased rollout approach. We first released the new version in one warehouse (the one in Valencia in this case), and two days later we released it to the rest of the warehouses. In case there was something wrong with the release we could fix it without impacting all the warehouses.</p><h3>How do we notify the user that there’s a new version?</h3><p>As we had an internal application which we weren’t releasing on Google Play we had to implement our own in-app update process, which worked as follows:</p><p>In the backend:</p><ul><li>Provides an endpoint that serves the supported versions range with a min and max version allowed.</li><li>Via middleware verifies that the version is within range, and if not, returns a 416 status.</li></ul><p>In the app:</p><ul><li>If we receive a 416 we show a non-dismissible dialog to force update the app version. This process downloads the APK from Google Cloud Storage and launches the installation process (although we need manual interaction to complete the installation) (Image1).</li><li>During daily use, the app checks if there is a newer version available, and if so, downloads the APK in background. Then once the user logs out it suggests installing the update (Image 2).</li></ul><p>When a new app version is released we make a request to that endpoint to update the maximum version supported.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*xA13YRqxkVKeoqPu1c62zA.png" /></figure><h3>Looking for automatization and refining the release process</h3><p>The next step was to start automating that process, for which we used Fastlane and Jenkins. With Fastlane we created scripts that Jenkins would run across its various stages: linting, unit tests, integration tests, and e2e tests. However, our release process was still manual and needed to find a way to automate it</p><p>We created a new lane in Fastfile to prepare a release: this created a new tag in GitHub and after that we had to go to Jenkins to build that tag manually. It was a start, we avoided building and signing the APK manually and uploading it to the Google Cloud Storage bucket.</p><p>As the project grew, we released versions with a lot of changes (remember that we were still waiting until Monday to launch them). This created a problem, the more changes a new version has, the higher the number of possible bugs there could be. This gave us an easy next step on which to improve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/0*afB9EBL930UTd1VV" /></figure><p>We discussed that point with the team and we all agreed that even though we planned to do a release in one warehouse first and then after two days to release in the rest of warehouses, we needed to take more measures to feel safe when we released new versions. The first one was an obvious one, to release smaller versions. The second one was to ensure we had a fast and automatic rollback mechanism. And the third one was to use feature flags to give us a way of removing bugs introduced by new features quickly without having to rollback or release a new version.</p><h3>How can we rollback a native app?</h3><p>Looking at other projects, we saw that they could easily perform rollback painlessly, just go to Jenkins, build a new version and let Jenkins do its thing, unfortunately we couldn’t do things the same way in Android.</p><p>Looking into the <a href="https://developer.android.com/studio/publish/versioning">official documentation</a>, there are two elements used to identify an APK:</p><ul><li>“versionName”: a string used as the version number shown to users.</li><li>“versionCode”: used by the Android system to protect against downgrades by preventing users from installing an APK with a lower versionCode than the version currently installed on their device.</li></ul><p>Does that mean that a direct rollback to an earlier version can’t be done? Well the documentation is pretty self explanatory but remember, we’re working with an internal application, so we were able to find a way around this and perform rollbacks.</p><p>We changed our code and the way we managed our versions. We decided to use the “versionName” as the actual version and then rather than updating the “versionCode” with each release, we decided to freeze it. Let look at this through an example:</p><ul><li>We release a new version v32 with “versionName” = 32 and “versionCode” = 1.</li><li>We release a new version v33 with “versionName” = 33 and “versionCode” = 1.</li><li>We realize there’s a bug in v33, so we need to perform a rollback. This is possible because v32 has the same versionCode as v33 (“versionCode” = 1) and so the Android system allows us to install an APK with the same versionCode.</li></ul><p>That’s how we created a rollback mechanism!</p><p>To show you a real world example, we realized we had a bug in v168 and so rolled back to v167. Notice how the version v168 is losing users as the out of range version dialog is shown!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kt74H00JceQE4vL9k4Ciwg.png" /><figcaption>Backend requests per each app version</figcaption></figure><h3>3rd party dependencies</h3><p>I want to explain this part in great detail to give a better understanding of the process. In the warehouse there’s a Delivery Manager who is responsible for coordinating all the drivers.</p><p>When the shift starts she has a meeting with all of them. There she distributes the routes and notifies them if there are any updates to the app. To give more detail about the new features in the app we create a document or a video which the Delivery Manager shares with the drivers.</p><p>After a few months a new person joined the team. She was in charge of creating these explanatory documents and videos, these were expected to be received when the version was already released or at least close to being released. A new player in the game!</p><p>After some weeks we realized that we had to split the two processes up so as not to create a bottleneck where one of us was waiting on the other; sometimes the document wasn’t ready on Monday and we had to delay the release to Tuesday or even Wednesday and vice versa. The two processes were tightly coupled and we needed to find a solution. This emphasized even more the need of using feature flags, and I have to say that once you start using them, you’ll never look back.</p><h3>Use feature flags and sleep better</h3><p>When we started using feature flags we decided to use <a href="https://firebase.google.com/products/realtime-database?gclid=CjwKCAjwn6GGBhADEiwAruUcKr1yjxdwN2l9xx_vi-eY1tcUBgxURoHkFu3Gtp6CxHZ_wIkUl8MgVxoCKqoQAvD_BwE&amp;gclsrc=aw.ds">Firebase Realtime Database</a>. As the name suggests it’s a database that propagates changes in real-time. Once the library is included in the app there’s a listener to notify when a key changes its value.</p><p>Using feature flags provided two improvements, firstly we had a way to hide a new feature if we detected a bug in new developments, and secondly, we could release versions even if the internal explanatory documentation wasn’t ready yet.</p><p>As we can see in the image below we define one feature flag per warehouse (Vlc1 — Valencia, Bcn1 — Barcelona, Mad1 — Madrid), so we can show or hide a new feature in each individual warehouse and feel safer when do release it that we have reduce the impact and risk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/508/0*-ho1arC7R_4Octi8" /><figcaption>Firebase Realtime Database for feature flag values</figcaption></figure><p>In the past weeks we’ve changed the way we manage feature flags and we stopped using Firebase Realtime Database and replaced it with our own API. We use the headers in the HTTP response to provide a list with the enabled feature flags. If a feature flag is not included in the list that means the feature flag is not enabled.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*PGVdxAaT-Y_CaQmt" /><figcaption>Android Studio logs for the app to see feature flags in API response headers</figcaption></figure><p>By using feature flags we not only achieved two of our three measures that we mentioned previously to make our release process safer but also we broke our dependency on the internal explanatory documentation.</p><p>This allowed us to start doing more releases per week and not only on Mondays.</p><h3>Last steps: we’re almost there!</h3><p>The next step was to reduce even further the size of the versions and do what was basically a <em>manual</em> continuous deployment, we were releasing single commit versions to test the whole process. After a few days of doing that we changed our Jenkinsfile so that it released a version with every merge to master and announced it to all our engineering team!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0T-fveHQcJuxQudq" /></figure><p>To summarize the evolution of the app during the last year and a half I would like to share with you some metrics from the last 12 months. As you can see, the number of commits per release decreases at the same time the number of releases goes up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/610/0*n0vo3HFvgXPsYaG0" /></figure><h3>Conclusions</h3><p>Before:</p><ul><li>Release trains</li><li>Huge versions (at the beginning some versions had up to 30 commits!)</li><li>No rollback mechanism</li><li>No feature flags</li><li>Dependency with a 3rd party</li></ul><p>After:</p><ul><li>Not worrying about when to release a version, every change is a release now</li><li>Single commit versions</li><li>Rollback mechanism</li><li>Feature flags</li><li>No dependency with any 3rd parties</li><li>Safer release environment (sometimes we perform up to 10 releases on Friday and it’s not an issue)</li></ul><p>It may seem like just a few changes but I assure you that it has been a long road full of learning and of course, a few bugs along the way!</p><p>In my opinion this can’t be achieved without knowing the product and the domain you’re working on. I wouldn’t start a project with continuous deployment at the beginning, I would build tools as necessary. <strong>Having an automated process saves you a lot of time and reduces all the friction of the release process.</strong> I remember the first few times when I had to build and sign the APK through Android Studio, then once it was finished, uploading it to the remote folder, updating the number of the last version in the Versions Service, sending a message to announce there’s been a new update. This now seems like an insane amount of work, whereas now I only have to merge a pull request and voilá!</p><p>On the other hand, it’s useless to have an automatic process if later we have many errors and we are too slow in solving them. <strong>We should feel comfortable that we are releasing not only in a fast-way but also in a safe-way.</strong></p><p>The next challenges are to adapt our flow to use Google Play instead of our Google Cloud remote folder. This has come about due to the fact that soon we’re going to be working with Android Enterprise and we want to take advantage of all of Google Play’s power. But I’ll save this for the next episode!</p><p>Stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1156abf5f856" width="1" height="1" alt=""><hr><p><a href="https://medium.com/mercadona-tech/how-we-achieve-continuous-deployment-in-a-native-app-1156abf5f856">How we achieve Continuous Deployment in a native app</a> was originally published in <a href="https://medium.com/mercadona-tech">Mercadona Tech</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>