<?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 Caner Gulgec on Medium]]></title>
        <description><![CDATA[Stories by Caner Gulgec on Medium]]></description>
        <link>https://medium.com/@canergulgec?source=rss-2bdc82d1b5a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Km9CAstUtR7EF9-7UauQNw.jpeg</url>
            <title>Stories by Caner Gulgec on Medium</title>
            <link>https://medium.com/@canergulgec?source=rss-2bdc82d1b5a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 18:08:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@canergulgec/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[UI Testing with Kakao & Testing REST APIs Using MockWebServer]]></title>
            <link>https://medium.com/armut-dev-blog/ui-testing-with-kakao-testing-rest-apis-using-mockwebserver-41be19398e72?source=rss-2bdc82d1b5a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/41be19398e72</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[kakao]]></category>
            <category><![CDATA[ui-testing]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[mockwebserver]]></category>
            <dc:creator><![CDATA[Caner Gulgec]]></dc:creator>
            <pubDate>Tue, 26 Jan 2021 14:23:12 GMT</pubDate>
            <atom:updated>2021-01-29T12:14:04.459Z</atom:updated>
            <content:encoded><![CDATA[<p>User Interface(UI) testing ensures that your application satisfies the functional requirements and works as intended. They are normally written using Android native testing framework which is <a href="https://developer.android.com/training/testing/espresso">Espresso</a> but in this post, I will show you how to write UI tests with <a href="https://github.com/agoda-com/Kakao"><strong>Kakao</strong></a><strong> </strong>and mock REST API responses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/333/1*LPoeqNuv8XoFii_bAXbnxg.png" /></figure><blockquote>Kakao is a library which is built on top of Espresso. It provides Domain-Specific-Language(DSL) for writing UI tests much more readable and understandable than Espresso.</blockquote><p>When your application makes API calls throughout the lifecycle of it, testing UI components can be inconsistent. To make the tests reliable, you need to mock the application’s network layer. Here comes the <a href="https://github.com/square/okhttp/tree/master/mockwebserver"><strong>MockWebServer</strong></a><strong> </strong>to the rescue.</p><blockquote>MockWebServer is a library that allows you mock the behavior of the remote server without making call over internet. With this way, you can implement different test scenarios easily.</blockquote><p><strong>UI Testing at Armut</strong> 🍐<br>As an android team at <a href="https://armut.com/">Armut</a>, we are aware that writing UI test is essential<br>in terms of improving the application’s quality and increasing the testing process because as you might guess, our application has many complex scenarios that no one can test manually and continuously before implementing UI tests. And, I must admit that sometimes we were spending too much time on it. Also, after start writing tests we minimized the time spent on finding potential bugs related to UI in the application.</p><p>Now, let’s dive into code! Add the following dependencies to the <strong>app-level</strong> Gradle file. Make sure to use the latest versions of them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/40c098a4cb3bac086621e4f401aaa54a/href">https://medium.com/media/40c098a4cb3bac086621e4f401aaa54a/href</a></iframe><p>Every project has some kind of base URL that you might refactor before implementing MockWebServer. To do that, create a function to get the base URL in your application class. Then, simply access it in RetrofitModule to use it. ( I did not add the whole class implementation)</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5922a665d73b9384c871e6d84ac8cacf/href">https://medium.com/media/5922a665d73b9384c871e6d84ac8cacf/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/acc9bc4d2d81be775116c5a826e91550/href">https://medium.com/media/acc9bc4d2d81be775116c5a826e91550/href</a></iframe><p>However, we have a problem! As we are using a mock server, we should not use the real base URL, instead, we need to change it with our local URL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*HMoyTj1ybHO6Pw7f_dH2GQ.jpeg" /></figure><p><strong>testRunner</strong> is the solution for this case. It allows us to configure our test environment and add the new conditions we set for our test cases.</p><ul><li>To achieve this, create a new test application class in <strong>androidTest </strong>directory to change the base URL with localhost.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bf1e6cf581f45e5281b5cf9e9f1345b7/href">https://medium.com/media/bf1e6cf581f45e5281b5cf9e9f1345b7/href</a></iframe><ul><li>Then, create a custom <strong>testRunner </strong>to use MovieTestApp in our test classes instead of MovieDbApp.</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0ae65ec4d4f83ade267f45e379deb1ca/href">https://medium.com/media/0ae65ec4d4f83ade267f45e379deb1ca/href</a></iframe><p><strong>newApplication</strong> method returns an application class that we provide for our tests.</p><ul><li>Open the <strong>app-level</strong> Gradle file and change <strong>testInstrumentationRunner </strong>implementation with your custom <strong>testRunner</strong>.</li></ul><pre>testInstrumentationRunner &quot;com.android.test.utils.MovieTestRunner&quot;</pre><p>Now, before moving on to writing tests, we should mock responses that remote API returns from the server. To do so, you need to make an API call and get the success response body in JSON format as we are testing this case. Copy the response and create a file named success_response.json. The sample response could be like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2955e361f90372c1317986af25eb736b/href">https://medium.com/media/2955e361f90372c1317986af25eb736b/href</a></iframe><p>After creating JSON response, create <strong>assets </strong>directory in-app module and put the JSON file there.</p><p>You need to find a way to read the JSON file because MockWebServer cannot read it directly. To read the file, we need to create a helper class. The goal of this class is simply writing JSON file contents in a String.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cdfecb72c33b91de115d646db0e5d99b/href">https://medium.com/media/cdfecb72c33b91de115d646db0e5d99b/href</a></iframe><p>You know that API calls are asynchronous operations and we need to make UI tests wait until the response comes from the server. We will be using <strong>Idling resources </strong>for this scenario. Now, create a test class in <strong>androidTest </strong>directory.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/064a30aad5da4b139c28a5e9ed874f54/href">https://medium.com/media/064a30aad5da4b139c28a5e9ed874f54/href</a></iframe><p><strong>@LargeTest</strong> annotation is not mandatory but recommended in UI tests. It states that the duration of the test can be greater than 1 second</p><p><strong>@Before</strong> annotation states that it will run before every test.</p><p><strong>@After</strong> annotation states that it will run after every test.</p><p>We have to start the mock server before each test and stop it after completing the tests. Put <strong>mockWebServer.start(port) </strong>inside setup method which will start <strong>mockServer </strong>on the port specified. Do not forget to stop it on the cleanup method.</p><p><strong>OkHttp3IdlingResource</strong> is a class that controls Kakao to wait until the OkHttp client completes its task. <strong>OkHttpProvider</strong> is another helper class that provides static OkHttp instance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/65bed739176aff4f8d458f93366d4709/href">https://medium.com/media/65bed739176aff4f8d458f93366d4709/href</a></iframe><p>For our test case, we should tell <strong>mockServer </strong>which response to return. To do that, paste the following code inside the test method.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/33f199c6e3834eaff8806e6940ff2cdf/href">https://medium.com/media/33f199c6e3834eaff8806e6940ff2cdf/href</a></iframe><p><strong>setResponseCode</strong> returns response code. You can change it as you wish for different scenarios like testing error cases.</p><p><strong>setBody </strong>returns<strong> </strong>the body of the response. In this case, we are reading our JSON file with FileReader class.</p><p><strong>Note</strong>: What if you have multiple API calls in your application and need to return a different responses for each request. Then you need to edit the dispatcher a bit.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f7c474a40a010cb155d2161ad14ced8c/href">https://medium.com/media/f7c474a40a010cb155d2161ad14ced8c/href</a></iframe><p>When you write tests with Kakao, you need to create a class that inherits from <strong>Screen </strong>which involves views in the interactions of the tests. Now, create MovieScreen class in <strong>androidTest </strong>directory. In this scenario, I will check whether the second RecyclerView item is visible on-screen or not.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/767b819ccc3c7db18e010695c04be12f/href">https://medium.com/media/767b819ccc3c7db18e010695c04be12f/href</a></iframe><p>Finally, we can check whether our test case is successfully implemented or not. Replace the MovieFragmentTest with the following:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/579ab1d27d9015d2b28e56963ba8c36b/href">https://medium.com/media/579ab1d27d9015d2b28e56963ba8c36b/href</a></iframe><p><strong>activityScenario</strong> launches the activity before running test methods.</p><p>As you can see, we can easily access the view references in MovieScreen and verify that the second RecyclerView item name is visible or not. Now, just sit back and run your test method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/274/1*XizKTpirhmlYGWZfwAUM3g.png" /></figure><p>You can access the full source code below the repository. <br>Happy Coding!</p><p><a href="https://github.com/CanerGulgec/MovieDb">CanerGulgec/MovieDb</a></p><p><strong>References<br></strong>* Subhrajyoti Sen — Testing Rest APIs Using MockWebServer<br>* Special thanks to <a href="https://medium.com/u/3f3b7a62e937">Engin CAN</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=41be19398e72" width="1" height="1" alt=""><hr><p><a href="https://medium.com/armut-dev-blog/ui-testing-with-kakao-testing-rest-apis-using-mockwebserver-41be19398e72">UI Testing with Kakao &amp; Testing REST APIs Using MockWebServer</a> was originally published in <a href="https://medium.com/armut-dev-blog">Armut Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android CI/CD pipeline with Bitrise : Deploy app to Google Play Store]]></title>
            <link>https://medium.com/armut-dev-blog/android-ci-cd-pipeline-with-bitrise-deploy-app-to-google-play-store-6bd95f652f8c?source=rss-2bdc82d1b5a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/6bd95f652f8c</guid>
            <category><![CDATA[continuous-deployment]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[bitrise]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[continuous-integration]]></category>
            <dc:creator><![CDATA[Caner Gulgec]]></dc:creator>
            <pubDate>Fri, 27 Nov 2020 14:45:01 GMT</pubDate>
            <atom:updated>2020-11-27T14:57:04.073Z</atom:updated>
            <content:encoded><![CDATA[<h3>Android CI/CD pipeline with Bitrise: Deploy your apps to Google Play Store</h3><p>In the mobile app industry, Continuous Integration(CI) and Continuous Deployment(CD) play an important role in terms of letting teams to deliver code changes frequently, safely, and automatically. Today, there are lots of different CI/CD tools like Jenkins, CircleCI, AppCircle and etc, but in this post, we will be talking about <strong>Bitrise</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CgHVPte4q3qQOpg5oPgD0g.png" /></figure><p>Before I deep dive into the topic let me explain what CI/CD is and why we really need it.</p><h4>What is Continuous Integration?</h4><blockquote>It is a software development practice that checks if the codes are acceptable for integration. CI workflow may include operations like app compilation, static code reviews and unit/UI testing with automated tools.</blockquote><h4>What is Continuous Deployment?</h4><blockquote>A continuous process which deploys codes to production system for every change that passes automated tests successfully.</blockquote><h3>Why should we use CI/CD?</h3><p>If you are working with a team, you should be familiar with the development process. Each team member opens pull requests and merges their codes in a continuous cycle. In most cases, the master branch should be the most stable one and ready for production when merging codes to it. However, how can we make sure that it is fully reliable and tested properly?</p><p>That’s the part where CI plays an essential role. For each code integration, it runs an automated build in the background and checks whether tests are successful or not. The advantage of using CI in the project is that developers can fix potential bugs as soon as possible.</p><p>In addition, the importance of using CD in the project enables the team to work more efficiently and increases the quality of the whole development process.</p><h3>Setting up Bitrise</h3><p>The first thing to do is to open <a href="https://www.bitrise.io/">bitrise.io</a> and create a new Bitrise project. This will only take 2– 3 minutes because Bitrise really simplifies this process for you.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VRB1jmLuAKCTz238CwbM8w.png" /></figure><p>After connecting your repository, Bitrise adds an SSH key into your repository automatically as a deploy key (This can be done manually if you have private dependencies). When the configuration is completed, Bitrise will ask you to register a webhook in your repository. This is really important because when you register a webhook, any code change in the repository will trigger the primary workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*af9lvgmLBwpwDEixrpqN9Q.png" /></figure><p>That’s it :) If the validation is successful, Bitrise will give you the default workflow based on the project configuration.</p><h3>Setup Google Play Project</h3><ul><li>First, you need to deploy the first APK or AAB manually to Play Store.</li><li>Secondly, open <strong>API ACCESS </strong>page in Play Store and link your API project by clicking “Create new project”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*vI0oksFZOSW4M0Obl8Se2g.png" /></figure><ul><li>Then, click on <strong>Create new service account</strong>. This will redirect you to Google Api Console</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HnpyrLF0RVfoaFgyF2dTcg.png" /></figure><ul><li>After completing service account details, don’t forget to create a private key (JSON file) and download it. We will use it later on.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ly6V_8Zz7GipMouBYwVhdg.jpeg" /></figure><ul><li>Now the last step is to grant access to the service account on Play Store. After that, we will have completed Play Store part of the deploying process.</li></ul><h3>Let’s open bitrise.io</h3><ul><li>After login with your account, select the project that you want to deploy and click on Workflow Editor.</li><li>The next step is to click on Code Signing tab. After uploading keystore file and keystore credentials, we need to upload the service account JSON key which we downloaded before.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdxfew6Yva54wItMycJRJg.png" /></figure><ul><li>In Bitrise, we have two workflows. <strong>Primary</strong> and <strong>Deploy</strong>. Just to clarify, both of them are created automatically when you add your app. They have almost the same steps and basically what they do is to activate the SSH keys, clone the Git repository, deploy build artifacts, and handle caching. Deploy workflow has extra steps for building the project and if the build is successful it deploys it to Play Store or any other market. For this tutorial, we will be only interested in deploying app to Play Store.</li><li>In deploy workflow, click on <strong>Android Build</strong> step. This step actually is similar to the primary workflow except for one thing. As we are planning to deploy it, we need to choose <strong>release</strong> variant. Build type is up to you. Choose apk or aab.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HTjwIp4Ld8pfxPx735uvkA.png" /></figure><ul><li>Next, click on <strong>Android Sign</strong> step. Bitrise generated env variables for us in the Code Signing tab when we provide our keystore credentials, so we can use them all for filling the required fields. If you are uploading apk, then you can use $BITRISE_APK_PATH. For aab it is $BITRISE_AAB_PATH. One final thing to mention is that, If your app targetSdk is 30, then you need to enable <strong>apksigner</strong> and choose v2 for <strong>APK Signature Scheme</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VMUcjFLgsZJOO_lnM3BCyA.png" /></figure><ul><li>We are really close to the ending! For the last step, you need to add <strong>Deploy to Google Play</strong> step to the end of the Workflow. Add your service account JSON key file path, app package name, and apk or aab file path to the required fields. For the track field, you need to choose where you want to deploy your app (internal, alpha, beta, production, or any custom track). That’s it! Your app is ready to auto-deploy.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SUVmOxAFVPAY4qu2jSZTAw.png" /></figure><ul><li>One more thing that I need to mention is when we need to trigger deploy workflow and how. Let me introduce you to <strong>Triggers</strong>. Go back to Workflow Editor and click on Triggers. For my case, I need to trigger deploy editor when somebody pushes codes to master branch. You can add as many triggers as you want. Also, for every pull request, I wanted the primary workflow editor to be triggered so that we can verify if something needs to be fixed before merging it. By the way, for every build, Bitrise notifies you via mail or slack about build status.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RXQop0SDbtD6K2-tQjxuww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EtYOlXzCuxnXqtcf8scgSA.png" /></figure><p>Bitrise really makes developers’ life easier even if you do not have any experience with CI/CD before. We did all the processes with Bitrise visual editor without writing a single line of code or something :)</p><h3>CI/CD at Armut🍐</h3><p>We were using CircleCI at <a href="https://armut.com/">Armut</a> for a couple of years. However, we migrated our applications successfully to Bitrise recently. There are two reasons which make us choose Bitrise over CircleCI.</p><ul><li><strong>Ease of use</strong>: Bitrise workflow editor provides us very simple and pleasing user interface. The best part of this tool is, we don’t have to struggle with .yml files.</li><li><strong>Out of memory(OOM)</strong>: CircleCI container started to throw OOM exception for each build lately. We tried many solutions like increasing container default size and Java heap size. However, we could not overcome the build error.</li></ul><p>By the way, if you are curious about how CI/CD was implemented at Armut before, you better check this <a href="https://labs.armut.com/implementing-android-ci-cd-pipeline-at-armut-68ebe14e33b7">post</a>.</p><p>Happy Coding!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6bd95f652f8c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/armut-dev-blog/android-ci-cd-pipeline-with-bitrise-deploy-app-to-google-play-store-6bd95f652f8c">Android CI/CD pipeline with Bitrise : Deploy app to Google Play Store</a> was originally published in <a href="https://medium.com/armut-dev-blog">Armut Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>