<?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[Modanisa Engineering - Medium]]></title>
        <description><![CDATA[Our mission is to build a global ecosystem that combines fashion and technology to serve the life style needs of modest women. Born in Istanbul (2011), we now have customers in 130+ countries. - Medium]]></description>
        <link>https://medium.com/modanisa-engineering?source=rss----197d03e79cce---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Modanisa Engineering - Medium</title>
            <link>https://medium.com/modanisa-engineering?source=rss----197d03e79cce---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 21:28:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/modanisa-engineering" 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 get a product management job? What do product managers look for when they hire PMs?]]></title>
            <link>https://medium.com/modanisa-engineering/how-to-get-a-product-management-job-what-do-product-managers-look-for-when-they-hire-pms-bec9796add05?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/bec9796add05</guid>
            <category><![CDATA[product-manager]]></category>
            <category><![CDATA[interview-tips]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[product-manager-interview]]></category>
            <dc:creator><![CDATA[Atakan Ülgen]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 13:03:29 GMT</pubDate>
            <atom:updated>2022-10-17T13:03:29.000Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*QL9gqx9JqTEEjhTe5U__mA.png" /></figure><p>First of all, this medium blog is actually the notes that I took from Uber Product Manager Randy Edgar’s Product School Talk. I really believe that Product School Talk is one of the best talks about what it takes to be a product manager. As a person who takes and gives interviews, <em>as someone on both sides</em>, I think this article will be useful and you will enjoy reading it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fjt7lv8lHvPLAqIMaytgUA.png" /><figcaption>Simulating an interview :)</figcaption></figure><blockquote><strong>First Tip: <br></strong>Never miss any interview opportunities, you don’t know what is under the hood.</blockquote><p>You can find the titles here;</p><ol><li>Goals and Metrics</li><li>Data-Driven Decisioning</li><li>Innovation</li><li>Technical Acumen</li><li>Overall Knowledge of Relevant Market</li><li>Leadership &amp; Vision</li><li>Execution (Get Shit Done)</li><li>Communication — <strong><em>MOST IMPORTANT :)</em></strong></li></ol><p>Let’s Start.</p><h3>Goals and Metrics</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*puMkdgW4RkifFd9o39qLcw.png" /></figure><p>The most important thing is why you are building it, and why you are doing it. It’s for your consumers -<em>of course</em>- of the product. But what are the goals and metrics you are going after? What&#39;s the goal of the company that you&#39;re tying your products back to?</p><p>If you are talking about the product, you’ll get this question a lot:</p><blockquote><strong><em>❓ What would you build if you are a part of this company?</em></strong></blockquote><p>🗣️ The company&#39;s goals and missions are x, y, and z. So I would want to build a product to tight back to the company&#39;s goal or mission. For example, Facebook → “<em>to keep the world more connected</em>”.</p><p>Whatever it is you are talking about needs to tight back to the mission of the company otherwise, it’s a red flag without even starting.</p><blockquote><em>🗣️ The other one is the metrics side. If you say I wanna build “XYZ”, the reason is it tights back to one of the goals in the company. and how I measure that is “blah blah”. Or the key metric that I&#39;m going after is usage, adoption, trip, or whatever it is.</em></blockquote><p>—</p><h3>Data-Driven Decisioning</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PUNyq7iLiqse2vL539u4LQ.png" /></figure><p>So what&#39;s gonna happen is after you mention that I wanna build “XYZ”. You need to explain how did you decide to do that “XYZ”. You don’t want to say, “because it’s really cool”. You want to say “it is really cool, because, data supports my argument”.</p><p>There are banners around Facebook saying:</p><blockquote>“<strong>Data wins arguments</strong>”</blockquote><p>It’s an awesome phrase for PMs.</p><blockquote><strong><em>❓How would you prioritize X over Y? Why would you do that?</em></strong></blockquote><p>The answer is always because data tells me that.</p><blockquote><em>🗣️ It is not necessarily SQL data or Google Analytics data, but also qualitative data that is coming from your users — some sort of data that supports your arguments-.</em></blockquote><p>—</p><h3>Innovation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7l2-kJlOQC8Ehr_Hns21Pg.png" /></figure><p>The question about what would you like to build… The reason why they are asked is not just for the goals and metrics, but also for the innovation.</p><p><em>How are you gonna raise the bar of the company?<br> </em><strong><br></strong>How I define that when I do these interviews, I just want one good idea, just one. The way we do that usually is;</p><blockquote><strong><em>❓“Take out your phone. Pick any app you use and tell me if you are a pm of that app, what would you build?”</em></strong></blockquote><p>The wrong answer is as you know, “<em>I know, I have that cool new idea</em>” ❌</p><p>🗣️ I know the goal of the company is “XYZ” and I assume one of your metrics is “ABC”, so if my assumption is correct increasing “ABC” will affect the “XYZ” positively. I will focus on increasing “ABC” by doing “<strong>this” </strong>new idea.</p><p>Sometimes that idea doesn’t come right away. Feel free to note down, sometimes you will be brainstorming with the PM in the room. Keep thinking and keep iterating. Jam with the manager.</p><h3>—</h3><h3>Technical Acumen</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p86faseuJuYQi9n5MTNDdA.png" /></figure><p>For those people, who are not technical, what you wanna do is ask the recruiter, how technical it is gonna be. They are some companies, that don’t care at all about being technical, but sometimes it requires.</p><p>The way Facebook did it, <br>1- They first ask you a very technical question, if you did not get it, it is ok.</p><p>2- Then they ask you another SQL-based question and if you don’t know, it is also ok. They just try to understand where your level is.</p><p>3- To understand how you think, they ask you to build a “<em>movie web page— chat app — x</em>” data model:</p><blockquote><strong><em>❓<br>Give me a data model of “X”? For example, you are building a product online book store? Tell me what the data model looks like.,</em></strong></blockquote><p>🗣️ The best answer is “What do you wanna know?”.</p><p>The idea is to answer a question with a question to understand exactly what they are looking for as an answer.</p><p>The bottom line of this is to ask follow-up questions to clarify the problem. You might not know the technical side that much, but your way of thinking is going to solve the problem.</p><p>—</p><h3>Overall Knowledge of Relevant Market</h3><p>Do I need to know about this market/business? This is a great question for the recruiter. Some companies really want you to know their business and their business model. Some companies like Facebook for example don’t care at all. Doing research and figuring out at least from the recruiter the company cares about the market, <strong>you better do your research.</strong></p><p>—</p><h3>Leadership / Vision</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ld1UfyLNeltQzDQqDzpv-A.png" /></figure><p>A good PM spends 80 percent of the time building the product. The other 20 percent of the time is working with designers to make sure that you have a vision for your product.</p><blockquote>2 years from now, what is our product look like?</blockquote><blockquote>What is that north star?</blockquote><blockquote>Where are we bringing the entire team so that we know when we build the roadmap, this is our angle.</blockquote><p>This is incredibly important to be a good PM. Without that, if you don’t have a way to articulate that through mocks — through designs you really have a hard problem trying to sell what it is that you are looking to do.</p><p>Because as a PM a lot of times you are in sales. You are selling your own product to upper management. Because you want resources to be able to build what you wanna build. Going back to the beginning<em>;</em></p><blockquote><em>🗣️ Here is what I want to do, <br>here are the metrics that I’m trying to drive, <br>here it tights back to the goal of the company, <br>but this is where are we trying to go, <br>and here is why?</em></blockquote><p>—</p><h3><strong>Execution</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ytrkGp2D2bwUrBKndJY5PQ.png" /></figure><p>One of the parts of the pie is</p><blockquote><strong><em>❓“Can this person get shit done? Can she/he execute?”</em></strong></blockquote><p>You have to sell yourself, but you should come prepared with a story, for how you get shit done?</p><blockquote><em>🗣️ ” I was up against this, I was up against this and this is I did it done, this is how I did the roadmap?”</em></blockquote><p>—</p><h3>Communication</h3><p>Be succinct.</p><p>In an interview be succinct. Never talk for more than 2–3 minutes and do not ask unnecessary questions. Because what you are doing is you are talking to them. They wanna communicate, they want to have a conversation with you. To question of an interviewer <strong>don’t talk too fast</strong>.</p><p>How does every job interview start?</p><blockquote><strong><em>❓Tell me about yourself?</em></strong></blockquote><p>Why do they ask that?</p><p>They want to test your communication skills. If you answer that question for 15 mins, think about the people listening to you for 15 minutes. Usually, It is over in 5 mins. By over I mean, the interview is over.</p><p>Most people really looking for your communication skills. How succinctly can you go through your background?</p><blockquote><em>🗣️ Talk about the highlights in max 3 minutes. And then say “hey would you like to hear more about ‘XYZ’?”</em></blockquote><blockquote><em>Because what happens is when you sell your elevator pitch to the upper management, how much time you will have there?</em></blockquote><p>If you get in a situation of “Tell me about yourself?” Just practice it. Make sure that you are skipping over the parts that are not that relevant.</p><p><strong>Tips</strong>: SMILE — One of the best tips here is to be personal, be friendly, and smile. Because people wanna hire people they like.</p><p>Book Suggestion: Malcolm Gladwell — Blink</p><p>It is important to connect with the interviewer on some level such as common points.</p><p>—</p><p>Usually, product managers do interviews also with designers. Obviously, any good product manager focuses on user experience. If you get a question about:</p><blockquote><strong><em>❓Tell me about a time you worked with design really well?</em></strong></blockquote><p>or</p><blockquote><strong><em>❓Tell me about a product that you think has a really good user experience? Or Tell me about a product that has a horrible user experience?</em></strong></blockquote><p>Don’t forget to prepare for it. The most important thing is to be collaborative on this. Because what designers looking for is to work with a product manager who listens to them.</p><p>—</p><h4>Additional Q&amp;A</h4><p><strong>❓ How do you measure the success of the newsfeed?<br></strong>🗣️ Depends on the goal. You need to understand what “success” mean, by asking the right questions.</p><p>—</p><p><strong>❓ You are the PM of Facebook Live. The amount of time people spend on Facebook live going up. But the problem is people&#39;s views of Facebook stories are getting lesser. What do you do? What you are doing is good but you are making someone else’s product.</strong></p><p>🗣️ What are we optimizing for? <strong><br></strong> — We are optimizing for the next three months “time on Facebook live”. <br>What we can do? <br>— We can monetize Facebook live. — We can collaborate with the other product manager and etc.</p><p>—</p><p><strong>❓ Tell me a feature that we should build?<br></strong>🗣️ What they looking for is “why” — “why, we are building it.” — “what metrics you are going to check”</p><p>—</p><p><strong>❓ The number of weekly users we get or engagement of the users do we have? How many or how often?<br></strong>🗣️ It depends, on the goal. 😀</p><p>—</p><p>Sometimes they ask you 3–4 hours to solve a case. In this case, what you should do is you need to understand the company goal and you need to make some assumptions. You should note each assumption. Because you know the company goal but you don’t know the product goal.</p><p>—</p><p><strong>❓ What would be your process for prioritizing the features?<br></strong>🗣️ Take everything that is on my roadmap and build all the business value for each of these features and I would rank them like this way. Then I need to go to the engineers to understand the challenge of it. Which makes us together doing trade-offs. etc etc.</p><p>—</p><p>I hope you liked it. In Modanisa we try to hire people who follow these rules. You can follow <br><a href="https://medium.com/modanisa-engineering">https://medium.com/modanisa-engineering</a> <br>for more. <br> — <br>This article was written together with <a href="https://medium.com/u/bad92e19a6b5">menguhan bulut</a>. <br>Go Follow his Medium channel.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bec9796add05" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/how-to-get-a-product-management-job-what-do-product-managers-look-for-when-they-hire-pms-bec9796add05">How to get a product management job? What do product managers look for when they hire PMs?</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Layout Service — The Backbone of Modanisa Website Replatforming]]></title>
            <link>https://medium.com/modanisa-engineering/layout-service-the-backbone-of-modanisa-website-replatforming-a0f9cca7ca46?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/a0f9cca7ca46</guid>
            <category><![CDATA[replatforming]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[legacy]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[strangler-pattern]]></category>
            <dc:creator><![CDATA[Taylan Kasap]]></dc:creator>
            <pubDate>Tue, 31 May 2022 10:21:42 GMT</pubDate>
            <atom:updated>2025-09-09T13:48:35.339Z</atom:updated>
            <content:encoded><![CDATA[<h3>Layout Service (Strangler Fig Pattern)— The Backbone of Modanisa Website Replatforming</h3><figure><img alt="Working on the legacy is similar to struggling with broken blinds." src="https://cdn-images-1.medium.com/max/576/1*WtDnzOLDuFIL19e6OgVgOQ.gif" /></figure><p><strong>Legacy projects</strong>, can’t live with them, can’t live without them. They’re a misery to work with but they also create a lot of job openings, which is nice I guess.</p><p>We also have one of those…</p><h3>The Problem That Needs to Be Solved</h3><p>As it stands Modanisa website is a monolith built on good old LEMP stack (Linux-Nginx-MySQL-PHP). By itself being a monolith is not the main problem. We probably wouldn’t have made a move on replatforming, if not for other issues. It’s called legacy and it’s a combination of issues such as:</p><ul><li>No automated tests</li><li>Slow for all users (both customers &amp; employees)</li><li>Too many bugs</li><li>Poor or non-existent monitoring/logging</li><li>Tech is outdated/unsupported</li><li>There is no documentation</li></ul><p><strong><em>More relatable list:</em></strong></p><ul><li>Developers don’t want to work on it</li><li>Adding a feature creates bugs in seemingly unrelated areas</li><li>When you get an error during some action you retry and it works</li><li>Only certain people know which parts work how or worse, no one knows how those parts work because the relevant people left the company</li><li><em>“if it works don’t touch it”</em></li></ul><p>Some of these may be true for even non-legacy projects, but if you have most of these issues then I’m sorry but it’s probably a legacy.</p><p>In addition to these issues we also wanted to change our tech stack from LEMP to whatever the projects require. We started with Go, Vue and NoSQL but there is nothing preventing us from using other tech too as the need arises. And while we are at it we moved to microservice architecture. But this post is not going to be about monolith vs microservice so let’s leave it at that.</p><h3>Options at Hand</h3><h4>1. Refactoring</h4><figure><img alt="n times later, legacy project becomes the refactored legacy project which is square root of n times better." src="https://cdn-images-1.medium.com/max/750/1*GXdkcN-YisjLw3ZFElfnSQ.png" /></figure><p>Depending on the project it might be possible to solve issues caused by legacy without rewriting the whole project. Not for us though.</p><h4>2. Complete Rewrite (Big Bang Replatforming)</h4><figure><img alt="2 years later, legacy project becomes the rewritten legacy project which is same but better (not really)." src="https://cdn-images-1.medium.com/max/750/1*7v9eZEqx0yYA-QLISXOOYw.png" /></figure><p><strong>Pros:</strong></p><ol><li>In total, takes less time and work compared to strangler fig pattern (we will talk about that below).</li></ol><p>To be honest I can’t find any other pros. Let me know in the comments.</p><p><strong>Cons:</strong></p><ol><li>Until replatforming finishes it doesn’t add any value to the business, which makes it difficult to convince the stakeholders to wait and be patient.</li><li>Because of feature freeze in the legacy codebase, it also stops adding any value even to the legacy business. And if you choose not to enforce feature freeze, then the rewritten project also needs them so you will have to implement the same feature twice at the same time.</li><li>If replatforming suddenly needs to be stopped — and that’s not a rare thing — , incomplete project goes to waste.</li><li>When creating the new project it’s very possible to accidentally skip some undocumented features in the legacy system.</li></ol><p>Let’s continue with our next option.</p><h4>3. Strangler Fig Pattern</h4><figure><img alt="few months later, legacy project becomes smaller legacy + modern. And few months later, it becomes even smaller legacy + larger modern. And so on." src="https://cdn-images-1.medium.com/max/750/1*4JqXdywWJnZleVkCO3AxQg.png" /></figure><p>This pattern is about gradually replacing your project piece by piece with replatformed tech until the legacy disappears.</p><p>Originally the name got popular as Strangler Pattern but apparently Fowler hopes the name will catch on as <strong>Strangler Fig</strong> rather than <strong>Strangler </strong>as he mentioned in his <a href="https://martinfowler.com/bliki/StranglerFigApplication.html">original post</a>:</p><blockquote>… The original post was entitled “Strangler Application”, and when used, the pattern is often referred to as a “strangler”. But its usage often gets separated from its metaphorical root, and takes on a unpleasantly violent connotation.</blockquote><blockquote>…</blockquote><blockquote>If I rename the post to “Strangler <em>Fig</em> Application”, and use the term “Strangler Fig” as much as possible, then hopefully that would reduce the violent connotation by reinforcing the metaphorical link that is the whole point of the name. …</blockquote><p>With strangler fig pattern while it’s technically possible to not touch the legacy codebase, it’s not a viable option in reality. Because more often than not, that codebase doesn’t have a proper architecture to implement the strangler fig pattern properly. So you will have to add little pieces of codes here and there.</p><p><strong>Pros:</strong></p><ol><li>Changes are reflected in the production website as you develop it, hence the <strong>business can reap the fruits</strong> of the renewed functionality without waiting for replatforming to finish.</li><li>And that makes it <strong>easier to convince the stakeholders</strong>.</li><li>Not much is wasted even if replatforming suddenly stops. <strong>Which reduces the risk.</strong></li></ol><p><strong>Cons:</strong></p><ol><li>In total, takes more time and work compared to complete rewrite. Especially if you intend to use microservices and your team is not used to microservice architecture.</li></ol><p>Let me know of other cons.</p><p>I tried not to list the pros/cons of microservice architecture because strangler fig pattern does not enforce microservice architecture — although they get associated most of the time.</p><p>Among these options strangler fig pattern is the best option for us — and to be honest for the most projects. So let’s talk about the details.</p><h3>Strangler Fig Pattern Options</h3><p>Choosing strangler fig pattern was just another step. Now we need to choose how to implement it.</p><h4>1. Adding Conditional Calls to Legacy Codebase</h4><p>This simply means calling the new microservices within legacy codebase if that part is replatformed and using the old legacy system if it’s not replatformed yet.</p><p>We didn’t want to tinker too much with the legacy system because it’s written in PHP and we’re trying to switch to Go. So for us it doesn’t make much sense to go with this option.</p><h4>2. Micro Front-end</h4><p>Micro front-ends are great, but you need to know the page layout for it to work. Unfortunately we — the replatforming team — don’t know the page layout, legacy does. While searching for options we’ve stumbled upon a project called <a href="https://github.com/zalando/tailor">Tailor</a>. It felt close to what we needed but as far as we could tell Tailor was also designed for page layouts known by the new system rather than the legacy system. Apparently to work with the legacy you need to <a href="https://github.com/zalando/tailor/issues/313">implement custom solutions</a> and also to get cookies &amp; headers you need to customize it even more. At that point it made more sense to create our own solution.</p><p>Which brings us to the next and main item.</p><h4>3. Custom Layout Service</h4><p>This service sends a request to the legacy website (from now on will be referred to as <strong>upstream</strong>), replaces necessary front-end parts and serves the updated website to the user. Let’s break it down.</p><p><strong>Sending request to the upstream </strong>means we need to wait for the upstream AND the replatformed website. Which is worse than the original response time. To solve this we need to tell the upstream that x, y, z parts are replatformed so you don’t need to generate them for this request.</p><p><strong>Replacing necessary front-end parts </strong>means we need to know which parts to replace, and replace them with what. This also comes in 2 parts:</p><ol><li>Which parts to replace gets deduced from the intersection of our configuration and the user’s parameters. E.g. 50% of users using the website in Sweden with English language should see the replatformed slider on the homepage.</li><li>Getting correct replacements from our new services.</li></ol><p>As you can see generating the correct replacements is not Layout Service’s job. If it was, that would mean we are replatforming monolith with another monolith. Instead we delegate that work to our microservices. Which means we are replatforming monolith with microservices.</p><h3>Conclusion</h3><p>We still have long way to go until replatforming is finished. No matter which option you choose, replatforming takes long time — relative to the legacy project’s size.</p><p>When our replatforming is finished we will become independent of legacy codebase and we will be able to drop it completely. At that point we can probably drop the Layout Service too since services specifically designed for micro front-ends should be enough and simpler.</p><p>If you have a migration project in your hands similar to what we had to go through you will also need to research and choose the best suited option for you.</p><p>Good luck to you all.</p><h3>Acknowledgements</h3><p><em>Special thanks to </em><a href="https://www.linkedin.com/in/kilicoglutuncay/"><em>Tuncay Kılıçoğlu</em></a><em> for sharing his knowledge about the beginning of the Layout Service.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0f9cca7ca46" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/layout-service-the-backbone-of-modanisa-website-replatforming-a0f9cca7ca46">Layout Service — The Backbone of Modanisa Website Replatforming</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to denormalize data by merging a table as an object into a document in couchbase]]></title>
            <link>https://medium.com/modanisa-engineering/how-to-denormalize-data-by-merging-a-table-as-an-object-into-a-document-in-couchbase-b9deb006eb33?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/b9deb006eb33</guid>
            <category><![CDATA[couchbase]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[n1ql]]></category>
            <dc:creator><![CDATA[Sevcan Doğramacı]]></dc:creator>
            <pubDate>Mon, 16 May 2022 14:01:23 GMT</pubDate>
            <atom:updated>2022-05-17T12:25:06.387Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3bJF69_mO2LiuSaxW--2A.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jandira_sonnendeck?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Jandira Sonnendeck</a> on <a href="https://unsplash.com/?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Imagine you have data in RDBMS, and at some point, you have decided to move your structure to Couchbase. You investigated the data and decided that you will denormalize a table into a document in migration. In this post, we will see how to embed data in a table with relation to couchbase documents.</p><h3>Data in RDBMS</h3><p>Let’s say you have two tables in relation:</p><ol><li>delivery_option table where you keep delivery options info.</li><li>delivery_option_translation table where you keep translations of delivery options.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IfejchBzleS8Gc9KV4sGVA.png" /><figcaption>delivery_option and delivery_option_translation tables</figcaption></figure><h3>Data Design in Couchbase</h3><p>Now, instead of creating two tables, you want to create one table for storing delivery options. You will eliminate delivery_option_translation table. But what happens to data there then?</p><p>The answer is simple. We will merge each delivery option’s translations into its document in Couchbase. So, a delivery option will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7R1CADTJ83LxZnkX2rFeow.png" /><figcaption>Sample delivery_option document in Couchbase</figcaption></figure><h3>Migration</h3><p>We can use couchbase:community-7.1.0 docker image to use couchbase in local.</p><h4>Prepare couchbase</h4><p><strong>1. Run</strong></p><pre>docker run -p 8091-8096:8091-8096 couchbase:community-7.1.0</pre><p><strong>2. Setup couchbase cluster</strong></p><ul><li>Go to <a href="http://localhost:8091/">localhost:8091</a></li><li>Configure cluster name, admin username, and password settings</li><li>Create a bucket called sample</li><li>Create a collection called delivery_option in sample bucket _default scope</li><li>Create additional scope called migration</li><li>Create a collection called delivery_option in sample bucket migration scope</li><li>Create a collection called delivery_option_translation in sample bucket migration scope</li></ul><p><strong>3. Import </strong><strong>delivery_option and </strong><strong>delivery_option_translation data</strong></p><ul><li>Download sample data <a href="https://github.com/SevcanDogramaci/denormalization-couchbase-example">here</a>.</li><li>Import <em>delivery_option.json</em> as JSON list into sample.migration.delivery_option keyspace using UUID.</li><li>Import <em>delivery_option_translation.json</em> as JSON list into sample.migration.delivery_option_translation keyspace using UUID.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_WShD9f3Wlopooig9yD8VQ.jpeg" /><figcaption>Import data screen</figcaption></figure><p><strong>4. Create indexes</strong></p><p>We need several primary and secondary indexes before running the merge query. Run queries to create these indexes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/edda573d2f63386fadfcd06ee4b9060b/href">https://medium.com/media/edda573d2f63386fadfcd06ee4b9060b/href</a></iframe><p><strong>5. Merge translations into delivery options and insert</strong></p><p>Run the merge query to insert delivery options into delivery_option collection in _default scope.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e931efa71c4fcedd3d40f738e8c959fc/href">https://medium.com/media/e931efa71c4fcedd3d40f738e8c959fc/href</a></iframe><p>If we take a look at the query deeper, we create an object v.`language`: v.translation with all translations of a delivery option by looping over.</p><ul><li>We use SELECT RAW OBJECT and [0] for eliminating the field attribute.</li><li>We use LEFT NEST for getting all translations even if there is no translation. (So that object will be empty.)</li><li>We use MERGE INTO ..... WHEN MATCHED ... query to insert or update new delivery options into a bucket.</li></ul><h3>Result</h3><p>Voila 🥳 Here are the delivery options data migrated!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5L-3Q7WmejBKpHFI5jTKpA.jpeg" /><figcaption>New delivery options with translations</figcaption></figure><p>To sum up, we achieved to merge data as an object to couchbase documents. That was it for this post, see u in the next episodes 🧐 🚗</p><p>References:</p><ul><li><a href="https://github.com/SevcanDogramaci/denormalization-couchbase-example">https://github.com/SevcanDogramaci/denormalization-couchbase-example</a></li><li><a href="https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/">https://docs.couchbase.com/server/current/n1ql/n1ql-language-reference/</a></li><li><a href="https://blog.couchbase.com/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql/">https://blog.couchbase.com/denormalize-imported-documents-rdbms-to-couchbase-using-n1ql/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9deb006eb33" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/how-to-denormalize-data-by-merging-a-table-as-an-object-into-a-document-in-couchbase-b9deb006eb33">How to denormalize data by merging a table as an object into a document in couchbase</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Theme Management with Clean Architecture]]></title>
            <link>https://medium.com/modanisa-engineering/flutter-theme-management-with-clean-architecture-111bbb13052d?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/111bbb13052d</guid>
            <category><![CDATA[flutter-theme]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[provider]]></category>
            <dc:creator><![CDATA[Murat Gun]]></dc:creator>
            <pubDate>Wed, 09 Mar 2022 05:57:48 GMT</pubDate>
            <atom:updated>2022-03-09T07:14:46.199Z</atom:updated>
            <content:encoded><![CDATA[<p>The theme is one of the indicator of the user-friendliness of a mobile application. Newly released applications are not considered very important and there is usually only one theme, but this is the wrong approach. Users want to customize the applications according to their own tastes, and they do this by choosing a theme in the easiest way. Today, I will tell you how you can manage themes with clean architecture in a Flutter application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ETqgXvSO7DWESwo7" /><figcaption>Photo by <a href="https://unsplash.com/@wacalke?utm_source=medium&amp;utm_medium=referral">Mateusz Wacławek</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>ARCHITECTURE</h3><p>Simply, in the architecture I use, the ThemeManager class provides the whole theme management. I’m using an enum to check for theme changes. I am listening for changes on MaterialApp using Provider package.</p><pre>provider: ^6.0.2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J3Ad2FjT5kot-2emcIENFA.png" /></figure><h3>IThemeManager Class</h3><p>This class is an abstract class to create a draft for ThemeManager class. The same structure will work without creating this class, but it is important to use an abstract class in order to be suitable for layered architecture.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac9400f5b82c776ea8baba345395ecb0/href">https://medium.com/media/ac9400f5b82c776ea8baba345395ecb0/href</a></iframe><h3>ThemeManager Class</h3><p>This class is our base management class for theme. We provide all theme-specific management with this class. Instant theme information is kept on ThemeEnum in the enum structure. When this value is entered as a parameter to the generateTheme() function, the function returns a widget of type ThemeData, which is the widget that contains the Theme features in Flutter.</p><p>In case of a theme change, the changeTheme() function is triggered by the user. This action replaces the instant theme enum value with that of the user selected theme. This change is listened by Change Notifier and forwarded to MaterialApp.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/68463800cb3e5896044d48bb7399fec9/href">https://medium.com/media/68463800cb3e5896044d48bb7399fec9/href</a></iframe><h3>Provider on ThemeManager</h3><p>I use provider to listen for theme changes because it seems to me the most logical choice. After all, I’m listening to the status of a single value, it should be a light solution, and I’m listening on a class that has a lazy singleton structure, so it would be ridiculous to use it as a controller or viewmodel. The easiest way to listen for changes in this class directly is to use the Provider package. After extending the changeNotifier to my ThemeManager class, I just need to listen to the changeTheme() function.</p><p>If you ask why I use MultiProvider. In this project, I do not only the theme, but also a few other managements with the provider package. That’s why I used MultiProvider.</p><pre>MultiProvider(<br>  providers: [<br>    ChangeNotifierProvider(create: (_) =&gt; ThemeManager.instance),      <br>  ],<br>  child: ThemeManagementApp(),<br>);</pre><h3>ThemeContextExtension</h3><p>I love using extensions in Flutter, this is one of them. This extension gives <strong>BuildContext </strong>the ability to listen for theme changes. Thanks to this extension, it is sufficient to simply write <strong>context.theme</strong> to the theme value in the MaterialApp widget. Also, since I call the ThemeData data as <strong>get</strong>, I gain a little bit of performance.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/776eba65c6d6f24cc8b2ea288491aaa7/href">https://medium.com/media/776eba65c6d6f24cc8b2ea288491aaa7/href</a></iframe><p>And you can use that extension in MaterialApp Widget like below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1afb4e5c43858388bd664cd20aadd7b7/href">https://medium.com/media/1afb4e5c43858388bd664cd20aadd7b7/href</a></iframe><h3>CustomThemes</h3><p>Finally, what I need is of course new theme data. We should create this data under ThemeData widget.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fd7e75ed8981d15ca03a6369c5c43695/href">https://medium.com/media/fd7e75ed8981d15ca03a6369c5c43695/href</a></iframe><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f74f9866c32144f3af47cf1b1192311/href">https://medium.com/media/2f74f9866c32144f3af47cf1b1192311/href</a></iframe><p>I almost forgot. You can also generate theme types from an abstract class. In this way, you will have the ability to manage all themes from a single source, especially in systems where you have multiple themes.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5352328ec2bc238c063c117f4c041e24/href">https://medium.com/media/5352328ec2bc238c063c117f4c041e24/href</a></iframe><h3>PANACHE</h3><p>As you know, ThemeData class has so many fields and it’s hard to enter all values as manually. So, thanks to Panache, Panache is a Flutter Theme editor and we can select our application colors and fonts at Panache web site and Panache gives us ThemeData class of our application.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*SR3aNdwyyYOnbDgbqR7yNw.gif" /></figure><p>Thank’s for reading.</p><p>For Panache : <a href="https://rxlabz.github.io/panache_web/#/">https://rxlabz.github.io/panache_web/#/</a></p><p>GitHub Repository :</p><p><a href="https://github.com/desxz/clean_theme_management">GitHub - desxz/clean_theme_management: Flutter theme management with clean architecture.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=111bbb13052d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/flutter-theme-management-with-clean-architecture-111bbb13052d">Flutter Theme Management with Clean Architecture</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue Test Utils Kılavuzu]]></title>
            <link>https://medium.com/modanisa-engineering/vue-test-utils-k%C4%B1lavuzu-9be2321f8f14?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/9be2321f8f14</guid>
            <category><![CDATA[vue-test-utils]]></category>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Atakan Tekoğlu]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 09:54:34 GMT</pubDate>
            <atom:updated>2022-02-21T09:54:34.047Z</atom:updated>
            <content:encoded><![CDATA[<p>Bölüm 2</p><p>Önceki yazımda “mounting a component, props, factory function, computed properties, emitted events” gibi konulara değinmiştim.</p><p>Bu yazımda hangi konuları ele alacağım?</p><ul><li>Mocking Global Objects</li><li>Triggering Events</li><li>Mocking a HTTP Client</li></ul><h3>Mocking Global Objects</h3><p>Bir component mount edilirken ikinci parametre olarak verdiğimiz options object içine <strong>mocks</strong> ayarını vererek <strong>vuex için $store, vue router için $router ve $route, vue-i18n için $t</strong> gibi global nesneler mocklanabilir.</p><p>Örnek olarak personel listesinin olduğu bir sayfanın var olduğunu düşünelim. Her bir personel üzerine tıklandığında ilgili personelin detaylarının görüneceği bir sayfaya gittiğimizi farz edelim. Bu detay sayfasına giderken personel bilgisinin <strong>personelId</strong> isimli route parametresine göre başlık olarak `<strong>personelId</strong> numaralı personel`yazsın. Bu örneğe göre mock işlemimizi yapalım.</p><pre>&lt;template&gt;<br>  &lt;h1 <em>id</em>=&quot;personel&quot;&gt;<br>    {{this.$route.params.personelId}} numaralı personel<br>  &lt;/h1&gt;<br>&lt;/template&gt;</pre><pre>&lt;script&gt;<br><em>export default </em>{<br>  name: &#39;PersonelContainer&#39;,<br>};<br>&lt;/script&gt;</pre><pre><em>import </em>{mount} <em>from </em>&quot;@vue/test-utils&quot;;<br><em>import </em>Personel <em>from </em>&quot;../../src/components/MockingGlobal/Personel&quot;;</pre><pre>describe(&quot;Mocking global objects&quot;, () =&gt; {<br>    <em>const </em>factory = (options) =&gt; {<br>        <em>return </em>mount(Personel,{<br>            mocks: {<br>                $route: {...options}<br>            }<br>        })<br>    }<br>    test(&quot;mocking route global object&quot;,() =&gt; {<br>        <em>const </em>params = {<br>                personelId: &#39;32&#39;<br>            }<br>        <em>const </em>wrapper = factory(params)<br>        expect(wrapper.find(&#39;#personel&#39;).text())<br>            .toBe(`${params.personelId} numaralı personel`)<br>    })<br>})</pre><p>Test dosyamızı incelediğimizde component mount edilirken mocks ayarının nasıl verildiğini ve içinde $route global nesnesinin ne şekilde mocklandığını görebiliyoruz.</p><p>Buna benzer olarak diğer global nesneler de mocklanabilir.</p><h3>Triggering Events — User Input</h3><p>Vue componentlerinde sıklıkla yapılan bir diğer iş ise kullanıcı ile etkileşime geçmek için kurulan form yapılarıdır. Bu bölümde user input olaylarının nasıl test edilebileceğine bakalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/790/1*MbBJFPmlCtru7LA3--niLg.png" /></figure><p>Örneğimizde bir login form olsun. Kullanıcı ismini ve parolasına girsin. Eğer parola ve kullanıcı ismi inputları dolu ise ‘welcome, kullanıcı’ gibi bir mesaj dönsün. Bu senaryoya göre işlemlerimizi yürütelim.</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;form <em>@submit.prevent</em>=&quot;login&quot;&gt;<br>      &lt;input <em>v-model</em>=&quot;username&quot; <em>data-username</em>&gt;<br>      &lt;input <em>v-model</em>=&quot;password&quot; <em>data-password</em>&gt;<br>      &lt;input <em>type</em>=&quot;submit&quot;&gt;<br>    &lt;/form&gt;</pre><pre>    &lt;div<br>        <em>class</em>=&quot;message&quot;<br>        <em>v-if</em>=&quot;submitted&quot;<br>    &gt;<br>      welcome, {{ username }}.<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br></pre><pre>&lt;script&gt;<br><em>export default </em>{<br>  name: &quot;UserInput&quot;,</pre><pre>  data() {<br>    <em>return </em>{<br>      username: &#39;&#39;,<br>      password: &#39;&#39;,<br>      submitted: <em>false<br>    </em>}<br>  },<br>  computed: {<br>    checkInputs(){<br>      <em>return this</em>.username.length &gt; 0 &amp;&amp; <em>this</em>.password.length &gt; 0<br>    }<br>  },<br>  methods: {<br>    login() {<br>      <em>this</em>.submitted = <em>this</em>.checkInputs<br>    }<br>  }<br>}<br>&lt;/script&gt;</pre><p>Şimdi bu component’e göre user input olaylarını gerçekleştirelim.</p><pre><em>import </em>{ mount } <em>from </em>&quot;@vue/test-utils&quot;;<br><em>import </em>UserInput <em>from </em>&quot;../../src/components/UserInput/UserInput&quot;;<br></pre><pre>describe(&quot;Simulating user input&quot;, () =&gt; {<br>    <em>const </em>factory = () =&gt; {<br>        <em>return </em>mount(UserInput)<br>    }<br>    test(&quot;should &quot;,<em>async </em>() =&gt; {<br>        <em>const </em>wrapper = factory()<br>        <em>await </em>wrapper.find(&quot;[data-username]&quot;).setValue(&quot;atakan&quot;)<br>        <em>await </em>wrapper.find(&quot;[data-password]&quot;).setValue(&quot;1234&quot;)<br>        <em>await </em>wrapper.find(&quot;form&quot;).trigger(&quot;submit.prevent&quot;)<br>        expect(wrapper.find(&quot;.message&quot;).text())<br>            .toBe(&quot;welcome, atakan.&quot;)<br>    })<br>})</pre><p>Sırası ile aşağıdaki işlemleri yaparız.</p><ul><li>username input’u bul ve içini doldur.<br><strong>- setValue kullanıcı girdisini simüle etmek için kullanılır.</strong></li><li>password input’u bul ve içini doldur.</li><li>Sırada form’u submit etmek var. Bu olay trigger ile gerçekleşir.<br>-trigger submit.prevent keydown.enter gibi modifiers kullanan evenler ile çalışır.</li><li>Son olarak mesajın doğru olarak verildiğinin kontrolü yapılır.</li></ul><p><strong>setValue ve trigger kendi iç yapılarında Vue.nextTick() döndürürler. nextTick DOM’un Vue Reactivity Sisteminin güncellenip güncellenmediğini kontrol eder. Buna bağlı olarak await setValue, await trigger kullanmamızın sebebi kısa yoldan nextTick olayını çözmek istememizden kaynaklanmaktadır. Bu şekilde Vue.nextTick() return edene kadar yani DOM güncellenene kadar beklemiş oluruz.</strong></p><p><a href="https://vue-test-utils.vuejs.org/guides/#testing-asynchronous-behavior">Asych olan bu yapı ile alakalı bu bilgileri buraya tıklayarak okuyabilirsiniz.</a></p><p><a href="https://github.com/atakanteko/medium-vue-test-utils/commit/3bac871213dfc18312c2c5ceff0c13d3839d6cab">Ayrıca ilgili commit’e giderek örneği inceleyebilirsiniz.</a></p><h3>Mocking a HTTP Client — Axios</h3><p>Form yapıları girilen verileri bir endpoint’e submit etmek için kullanılır. Endpoint ile iletişime geçmek http kütüphaneleri kullanırız. Bu başlık altında Axios kütüphanesi kullanarak bir ajax request nasıl mocklanır öğreneceğiz.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7WhRRggqrNZH6ZvqMsiYlg.png" /></figure><p>İstek atacağımız API <a href="https://jsonplaceholder.typicode.com/">https://jsonplaceholder.typicode.com/</a> adresi olacak ve /posts/id endpoint’e istek atacağız.</p><p>Örnek olarak /posts/1 e istek atarsak dönen değer aşağıdaki gibi olur.</p><pre>{<br>  &quot;userId&quot;: 1,<br>  &quot;id&quot;: 1,<br>  &quot;title&quot;: &quot;sunt aut facere repellat provident occaecati excepturi optio reprehenderit&quot;,<br>  &quot;body&quot;: &quot;quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto&quot;<br>}</pre><p>İlk olarak Vue componentimizi oluşturalım.</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;form <em>@submit.prevent</em>=&quot;getTodo&quot;&gt;<br>      &lt;input <em>type</em>=&quot;number&quot; <em>v-model.number</em>=&quot;todoId&quot; <em>data-id</em>&gt;<br>      &lt;input <em>type</em>=&quot;submit&quot;&gt;<br>    &lt;/form&gt;<br>    &lt;div <em>v-if</em>=&quot;todo&quot;&gt;<br>      &lt;h1 <em>data-title</em>&gt;{{this.todo.title}}&lt;/h1&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br></pre><pre>&lt;script&gt;<br><em>import </em>axios <em>from </em>&#39;axios&#39;<br><em>export default </em>{<br>  name: &quot;MockingAxios&quot;,<br>  data() {<br>    <em>return </em>{<br>      todoId: &#39;&#39;,<br>      todo: <em>null</em>,<br>    }<br>  },<br>  methods: {<br>    <em>async </em>getTodo() {<br>      <em>try </em>{<br>        <em>const </em>response = <em>await </em>axios.get(`https://jsonplaceholder.typicode.com/posts/${<em>this</em>.todoId}`)<br>        <em>this</em>.todo  = response.data<br>      } <em>catch </em>(e) {<br>        console.log(e)<br>      }<br>    }<br>  }<br>}<br>&lt;/script&gt;</pre><p>Component incelenecek olursa kullanıcıdan bir id girilmesi beklenir ve submit anında ise api ile iletişim sağlanır. Dönen değer todo datasına yazılır ve h1 etiketi içinde title alanı ekrana yazılır.</p><p>Şimdi testimizi adım adım oluşturmaya başlayalım.</p><p>İlk olarak sorulması gereken soru Axios HTTP Client nasıl mocklanır olmalıdır. Madem ki ben axios.get ile endpoint’e istek atacağım bunu mocklamam gerekmekte. Yapmam gereken ilk iş belli oldu.</p><ul><li>Adım 1: axios library test dosyasına eklenir.</li></ul><pre><em>import </em>axios <em>from </em>&quot;axios&quot;;</pre><ul><li>Adım 2: axios dahil edildi sıradı bu modulün davranışının değiştirilmesi gerekliliği var. Çünkü ben gerçek bir istek atmak istemiyorum. Bunu ise jest.mock(…) bizim için sağlamakta. Bir modülü mocklamak için jest.mock() kullanılabilir.</li></ul><p>get isteğini attığımda bana bir promise dönecek ve bunu çözerek gelen veriyi karşılamam gerekecek. Madem durum böyle işliyor kendi promise yapımı oluşturup buna göre resolve edebilirim.</p><pre><strong>jest.mock(&quot;axios&quot;,()=&gt;({<br>    get: (_url) =&gt; {<br>        <em>return new </em>Promise((resolve) =&gt; {<br>            resolve(<em>true</em>)<br>        })<br>    }<br>}))</strong></pre><p>Yukarıda bir axios modülünün mocklamasının reçetesini görüyoruz. İlk parametre hangi modülün mocklanacağı olur. Zaten bu modülü adım 1 de test dosyasına ekliyoruz. <strong>Bu demek oluyor ki ilgili component mount edildiğinde şayet içinde axios’a bağlı bir get işlemi yapılıyorsa mecburen bu süzgeçten geçecektir. Yani mocklanmış olacaktır.</strong></p><p>Bu reçeteyi baz alarak geliştirmeyi devam ettirelim.</p><ul><li>Adım 3: /posts/1 ve /posts/2 endpoinlerine istek attığımda hangi veriler dönüyor bunları Promise içinde belirt. Çünkü id:1 ve id:2 için farklı değerler döner. Bunları testin assertion kısmında kıyas olarak kullanacağız.</li></ul><pre>jest.mock(&quot;axios&quot;,()=&gt;({<br>    get: (_url) =&gt; {<br>        <em>return new </em>Promise((resolve) =&gt; {</pre><pre><strong><em>const </em>responseData = [<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 1,<br>                        &quot;title&quot;: &quot;sunt aut facere repellat provident occaecati excepturi optio reprehenderit&quot;,<br>                        &quot;body&quot;: &quot;quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto&quot;<br>                        }<br>                },<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 2,<br>                        &quot;title&quot;: &quot;qui est esse&quot;,<br>                        &quot;body&quot;: &quot;est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla&quot;<br>                        }<br>                }<br>           ]</strong></pre><pre>resolve(true)<br>            <br>        })<br>    }</pre><ul><li>Adım 4: Madem ki get isteği benim mock süzgecimden geçecek o zaman istek atılan adresin son kısmındaki id değerini alırım ve response data içindeki id ile kıyaslama yaparak resolve kısmında ona göre ilgili response’yi dönerim.<br>Yani /posts/1 e istek atılmışsa 1&#39;i yakalarım ve sonrasında responseData[0].data.id ile kıyaslarım ve ilk datayı resolve ederim. Buna göre de assertion yapabilirim.</li></ul><pre>jest.mock(&quot;axios&quot;,()=&gt;({<br>    get: (_url) =&gt; {<br>        <em>return new </em>Promise((resolve) =&gt; {<br>            <em>const </em>responseData = [<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 1,<br>                        &quot;title&quot;: &quot;sunt aut facere repellat provident occaecati excepturi optio reprehenderit&quot;,<br>                        &quot;body&quot;: &quot;quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto&quot;<br>                        }<br>                },<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 2,<br>                        &quot;title&quot;: &quot;qui est esse&quot;,<br>                        &quot;body&quot;: &quot;est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla&quot;<br>                        }<br>                }<br>           ]<br>            <strong><em>const </em>_id = _url.split(&quot;/&quot;).slice(-1)<br>            <br>            <em>if </em>(parseInt(_id)===responseData[0].data.id){<br>                resolve(responseData[0])<br>            } <em>else </em>{<br>                resolve(responseData[1])<br>            }</strong><br>        })<br>    }<br>}))</pre><ul><li>Adım 5: Assertion kısmında url kontrolü yapmak için son olarak global bir url değişkeni tanımlarım ve get(_url) içine gelen url’i bu global değişkene eşitlerim.</li></ul><pre><strong><em>let </em>url = &#39;&#39;</strong><br>jest.mock(&quot;axios&quot;,()=&gt;({<br>          ........<br>          .......<br>            <em>const </em>_id = _url.split(&quot;/&quot;).slice(-1)<br>            <strong>url = _url</strong><br>            <em>if </em>(parseInt(_id)===responseData[0].data.id){<br>                resolve(responseData[0])<br>            } <em>else </em>{<br>                resolve(responseData[1])<br>            }<br>        })<br>    }<br>}))</pre><p>Test dosyamızın tamamını ekleyerek test kontrollerimizi yapalım.</p><pre><em>import </em>{ mount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>MockingAxios <em>from </em>&quot;../../src/components/MockingAxios/MockingAxios&quot;;<br><em>import </em>axios <em>from </em>&quot;axios&quot;;<br><em>import </em>flushPromises <em>from </em>&quot;flush-promises&quot;</pre><pre><em>let </em>url = &#39;&#39;<br><strong><em>const </em>ids = {id1:&#39;1&#39;,id2:&#39;2&#39;}</strong><br><strong><em>const </em>expectedResult =  [<br>    {<br>        &quot;data&quot;: {<br>            &quot;userId&quot;: 1,<br>            &quot;id&quot;: 1,<br>            &quot;title&quot;: &quot;sunt aut facere repellat provident occaecati excepturi optio reprehenderit&quot;,<br>            &quot;body&quot;: &quot;quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto&quot;<br>        }<br>    },<br>    {<br>        &quot;data&quot;: {<br>            &quot;userId&quot;: 1,<br>            &quot;id&quot;: 2,<br>            &quot;title&quot;: &quot;qui est esse&quot;,<br>            &quot;body&quot;: &quot;est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla&quot;<br>        }<br>    }<br>]</strong></pre><pre>jest.mock(&quot;axios&quot;,()=&gt;({<br>    get: (_url) =&gt; {<br>        <em>return new </em>Promise((resolve) =&gt; {<br>            <em>const </em>responseData = [<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 1,<br>                        &quot;title&quot;: &quot;sunt aut facere repellat provident occaecati excepturi optio reprehenderit&quot;,<br>                        &quot;body&quot;: &quot;quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto&quot;<br>                        }<br>                },<br>                {<br>                    &quot;data&quot;: {<br>                        &quot;userId&quot;: 1,<br>                        &quot;id&quot;: 2,<br>                        &quot;title&quot;: &quot;qui est esse&quot;,<br>                        &quot;body&quot;: &quot;est rerum tempore vitae\nsequi sint nihil reprehenderit dolor beatae ea dolores neque\nfugiat blanditiis voluptate porro vel nihil molestiae ut reiciendis\nqui aperiam non debitis possimus qui neque nisi nulla&quot;<br>                        }<br>                }<br>           ]<br>            <em>const </em>_id = _url.split(&quot;/&quot;).slice(-1)<br>            url = _url<br>            <em>if </em>(parseInt(_id)===responseData[0].data.id){<br>                resolve(responseData[0])<br>            } <em>else </em>{<br>                resolve(responseData[1])<br>            }<br>        })<br>    }<br>}))</pre><pre><strong>describe(&quot;Mocking a HTTP Client&quot;, () =&gt; {<br>    <em>const </em>factory = () =&gt; {<br>        <em>return </em>mount(MockingAxios)<br>    }</strong></pre><pre><strong>    test.each([[ids.id1, expectedResult[0].data.title],[ids.id2, expectedResult[1].data.title]])(&#39;Mocking Axios&#39;,<br>        <em>async </em>(firstArgs, expectedResult) =&gt; {<br>        <em>const </em>wrapper = factory()<br>        <em>await </em>wrapper.find(&quot;[data-id]&quot;).setValue(firstArgs)<br>        <em>await </em>wrapper.find(&quot;form&quot;).trigger(&quot;submit.prevent&quot;)<br>        <em>await </em>flushPromises()<br>        expect(url).toBe(`https://jsonplaceholder.typicode.com/posts/${firstArgs}`)<br>        expect(wrapper.find(&quot;[data-title]&quot;).text()).toEqual(expectedResult)<br>    });<br>})</strong></pre><p>Yukarda test dosyamızın tamamı görünmekte. Bu testte test.each kullanılmaktadır. Amacı farklı durumları içeren testleri tek bir noktadan test etmek için bize kolaylık sağlamasıdır. Daha detaylıca kontrol etmek isterseniz takip eden linke tıklayabilirsiniz.[<a href="https://dev.to/bgord/simplify-repetitive-jest-test-cases-with-test-each-310m">test.each</a>]</p><p>İlk olarak globalde 1 ve 2 olarak id’ler tanımlanır.</p><pre><strong><em>const </em>ids = {id1:&#39;1&#39;,id2:&#39;2&#39;}</strong></pre><p>Sonrasında bunlara özel postlar apiden alındığında dönecek olan değerler expect kısmında iddia edilebilmesi için <strong>expectedResult</strong> isimli dizi içine tanımlanmıştır.</p><p>Geriye sadece input’a giriş yapıp submit eventini triggerlamak kalıyor. Trigger işleminden sonra yazılan <strong>flushPromises()</strong> ise durumu pending olan tüm promiseleri anında çözer ve DOM update olur.</p><p>İlk assertion işlemimiz doğru adrese istek atılıp atılmadığını test eder.</p><pre><strong>expect(url).toBe(`https://jsonplaceholder.typicode.com/posts/${firstArgs}`)</strong></pre><p>İkinci assert işleminde ise istek doğru döndü ise render edilen title karşılaştırma yapılarak iddia işlemi sona erdirilir.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9be2321f8f14" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/vue-test-utils-k%C4%B1lavuzu-9be2321f8f14">Vue Test Utils Kılavuzu</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vue Test Utils Kılavuzu]]></title>
            <link>https://medium.com/modanisa-engineering/vue-test-utils-k%C4%B1lavuzu-ec7a4543f245?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/ec7a4543f245</guid>
            <category><![CDATA[test-driven-development]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[vue-test-utils]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Atakan Tekoğlu]]></dc:creator>
            <pubDate>Wed, 16 Feb 2022 13:55:57 GMT</pubDate>
            <atom:updated>2022-02-16T13:55:57.659Z</atom:updated>
            <content:encoded><![CDATA[<h4>Bölüm 1</h4><p>Bu yazımda Vue componentlerinin Vue Test Utils ile nasıl ve ne şekilde test edilebileceğine dair kısa ve ilgili maddeye odaklı örneklerine ulaşabilirsiniz.</p><p>Kodlarımızı test etmek için Vue Test Utils ve Jest kullanıyoruz. VTU aslında alt tarafta Jest’i kullanmaktadır. Yani VTU öğrenirken aynı zamanda da Jest öğreniyorsunuz. Basit örneklerle bu iki aracın ne şekilde kullanılabileceğine dair öğrendiklerimi paylaşacağım. Son olarak, her bir örnek birbirinden bağımsız olarak ele alınacaktır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*ZU78WVc7E5ca2l1wdBARpA.png" /><figcaption>Vue Test Utils ve Jest</figcaption></figure><p>Bu yazımda hangi konulara değindim?</p><ul><li>Mounting Component<br>-mount<br>-shallowMount</li><li>Testing Props</li><li>Factory Function</li><li>Testing Computed Properties</li><li>Testing Emitted Events</li></ul><p>Vue Test Utils render edilen DOM üzerinde kolay bir şekilde dolaşmamız için bize gerekli tüm araçları sunar. Bir component’e ait üyelerin (methods, computeds, vs.) test edilebilmesi için soyutlanmış olarak bizim elimizde bulunması gerekir. Bu soyutlama işlemini ise VTU iki şekilde gerçekleştirir; bunlar mount ve shallowMount olarak adlandırılır. İlk olarak bu iki unsurun ne olduğunu öğrenerek başlayalım.</p><h3>Mounting Vue Instance (mount vs shallowMount)</h3><p>Test edilecek olan hedef component’in soyut bir versiyonuna ulaşmak için mount ve shallowMount kullanılır. Component mount edildiğinde bize bir <strong><em>wrapperobject</em></strong> döner. Bu object içinde component’i test etmek için gerekli olan yardımcı fonksiyonlar bulunur.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3N21Fqx63r6ozCok5KwFAw.png" /><figcaption>mount metot deklarasyonu</figcaption></figure><p>mount ve shallowMount ikilisinin yaptığı görev temel olarak aynı olmakla birlikte bir fark ile ayrılmaktadırlar. Şimdi hem bir component nasıl mount edilir hem de bu farkın ne şekilde tanımlandığını öğreneceğimiz ilk örneğimizi yapalım.</p><p>Parent-child ilişkisine sahip iki componentimiz olsun: Book ve Page componentleri.</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;Page/&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br>&lt;script&gt;</pre><pre><em>import </em>Page <em>from </em>&quot;./Page&quot;;<br><em>export default </em>{<br>  name: &#39;BookComponent&#39;,<br>  components: {<br>    Page,<br>  },<br>};<br>&lt;/script&gt;</pre><pre>&lt;template&gt;<br>  &lt;h1&gt;Page Component&lt;/h1&gt;<br>&lt;/template&gt;<br><br>&lt;script&gt;<br><em>export default </em>{<br>  name: &#39;PageComponent&#39;,<br>};<br>&lt;/script&gt;</pre><p>Şimdi ise test tarafında <strong><em>renderingComponent.spec.js</em></strong> isimli test dosyamızda işlemlerimize devam edelim.</p><p>Aşağıda ilk olarak mount ve shallowMount, sonrasında hedef componentler Book ve Page vue dosyaları import edilir. Ayrıca mount fonksiyonu bize bir <strong><em>wrapper object </em></strong>döndürür ve bunun içinde yardımcı fonksiyonlarımız bulunur demiştim. Bu test için <strong>html()</strong> yardımcı fonksiyonunu kullanıyoruz.</p><pre><em>import </em>{ mount,shallowMount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>Page <em>from </em>&#39;../../components/Page&#39;<br><em>import </em>Book <em>from </em>&quot;../../components/Book&quot;;<br><br>describe(&quot;Rendering Components&quot;, () =&gt; {<br>    test(&quot;render child component with shallow mount&quot;,() =&gt; {<br>        <em>const </em>shallowWrapper = shallowMount(Page)<br>        <em>const </em>mountWrapper = mount(Page)<br>        console.log(shallowWrapper.html())<br>        console.log(mountWrapper.html())<br>    })<br>})</pre><p>İlk testimizde child component olan Page.vue mount ve shallowMount ile soyutlanmış biçimde elimize geçer. Dikkat edilirse component iki şekilde mount edildikten sonra dönen wrapper object değişkende tutuluyor. Sonra her iki yöntem için html() yardımcı fonksiyon çağırılıyor ve log işlemi gerçekleşiyor. Peki log bize ne yazdırdı bir göz atalım.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*S9MWwySJ9v5sYjAIP7fzjw.png" /></figure><p>Loglama işlemini incelediğimizde bir sürprizle karşılaşmıyoruz. Çünkü Page.vue içerisinde sadece ama sadece render edilen tek bir &lt;h1&gt;&lt;/h1&gt; html etiketi bulunuyor.</p><p>Şimdi parent component olan Book.vue dosyasını iki şekilde mount edip loglama işlemini gerçekleştirelim. Yukarda yazdığımız test altına aşağıdaki testi ekleyelim.</p><pre>test(&quot;render parent component with mount&quot;,() =&gt; {<br>    <em>const </em>shallowWrapper = shallowMount(Book)<br>    <em>const </em>mountWrapper = mount(Book)<br>    console.log(shallowWrapper.html())<br>    console.log(mountWrapper.html())<br>})</pre><p>Bu testimizin çıktısını inceleyelim.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*M548NUaGZ4FOqOkOQUpZlg.png" /></figure><p>Burada shallowMount ile mount arasındaki farkı anlamaya başlıyoruz. İkinci log satırında mount ile soyutlanan parent component kendisi içinde render edilen Page.vue component’i içinde bulunan &lt;h1&gt; etiketi altındaki Page Component yazısını yazdırdır.</p><p>Öte yandan ilk satırdaki log işlemine baktığımızda shallowMount ile soyutlanan parent component Page.vue component’i yerine</p><pre>&lt;page-stub&gt;&lt;/page-stub&gt;</pre><p>gibi bir ifade bastırdı. shallowMount soyutladığı component olan Book.vue içerisinde render edilen child component olan Page.vue ile ilgilenmedi. Onu bir stub olarak gördü.</p><pre><strong>Stub: gerçeği anlamına gelen sahte bir object</strong></pre><p>Toplayacak olursak <strong>mount</strong> child componentleri de render ederken <strong>shallowMount</strong> sadece ilgili component elemanlarını render eder ve child olanları bir stub olarak değerlendirir.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*CVyPQ15AcMsBMcoSe6tSiQ.png" /></figure><p>Takip eden bağlantıya tıklayarak ilgili commit’i inceleyebilirsiniz.<a href="https://github.com/atakanteko/medium-vue-test-utils/commit/2e8d1a05c46de89d3735af6d9d31ea64260200fc">[mount vs shallowMount]</a></p><h3>Testing Props</h3><p><a href="https://v2.vuejs.org/v2/guide/components-props.html">Parent component ile child component arasındaki veri akışı props denilen özel veri taşıyıcılarla yapılır.</a> Bu araçların testini yaparken mount ve shallowMount fonksiyonlarına verilen ikinci bir parametre bize yardımcı olur.</p><p>Aşağıdaki yapıyı incelersek bir component mount edilirken <strong>ikinci parametre olarak bir object </strong>alır. Bu object içinde <strong>propsData</strong> denilen özel yapı ile hedef component prop’larına veri aktarımı yapılır ve test işlemleri buna göre gerçeklenir.</p><pre>const wrapper = mount(Foo, {<br>  propsData: {<br>    foo: &#39;bar&#39;<br>  }<br>})</pre><p>Aşağıda yine parent-child ilişkisine sahip olan iki component bulunmaktadır: LoginContainer.vue ve LoginForm.vue</p><p>Aşağıdaki kod örneğinde LoginContainer, LoginForm componentini kapsar ve prop olarak <strong>isAdmin</strong> isimli Boolean bir değer gönderir. Eğer isAdmin ‘true’ ise admin’e özel bir giriş formu değilse kullanıcıya özel bir giriş formunun gösterildiği bir senaryo hazırlanmıştır.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/1*D-Opte8nI0scxH0kuTRZ8g.png" /></figure><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;LoginForm <em>:isAdmin</em>=&quot;<em>true</em>&quot;/&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script&gt;<br><em>import </em>LoginForm <em>from </em>&quot;./LoginForm&quot;;<br><em>export default </em>{<br>  name: &#39;LoginContainer&#39;,<br>  components: {<br>    LoginForm,<br>  },<br>};<br>&lt;/script&gt;</pre><p>Yukarıda LoginForm componentinin LoginContainer içinde render edildiğini ve isAdmin isimli prop binding işlemini görebiliyoruz.</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;div <em>v-if</em>=&quot;isAdmin&quot; <em>data-test</em>=&quot;admin-form&quot;&gt;Admin Form Design&lt;/div&gt;<br>    &lt;div <em>v-else data-test</em>=&quot;user-form&quot;&gt;User Form Design&lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script&gt;<br><em>export default </em>{<br>  name: &#39;LoginForm&#39;,<br>  props: {<br>    isAdmin: {<br>      type: Boolean,<br>      <em>default</em>: <em>false<br>    </em>},<br>  },<br>};<br>&lt;/script&gt;</pre><p>Yukarıda LoginForm componentinin yapısını görebilirsiniz. Eğer isAdmin:true ise hayali olarak Admin Form değilse User form render edilecektir. Şimdi bunun testini yapalım.</p><pre><em>import </em>{ mount,shallowMount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>LoginForm <em>from </em>&quot;../../src/components/PropsData/LoginForm&quot;;<br><br><br>describe(&quot;Props Data Testing&quot;, () =&gt; {<br>    test(&quot;should render user form&quot;,() =&gt; {<br>        <em>const </em>shallowWrapper = shallowMount(LoginForm, {<br>            propsData: {<br>                isAdmin: <em>false<br>            </em>}<br>        })<br>        expect(shallowWrapper.find(&quot;[data-test=\&quot;user-form\&quot;]&quot;).text())<br>            .toBe(&quot;User Form Design&quot;)<br>    })<br>})</pre><p>Test işleminin detaylarını anlatmaya başlayalım. mount fonksiyonunun ikinci parametresine bir object ve bunun içine prop binding işlemini yapabilmemiz için bize yardımcı olan propsData’nın nasıl verildiğini görebiliyoruz.</p><p>isAdmin, child componentimin beklediği prop’tur. Buna göre ilk olarak false olarak bind edelim ve false olması durumunda User Formun render edileceğini bekleriz.</p><ul><li>expect → user form render edildi mi?</li><li>toBe → edildi ise bunu doğrula</li></ul><p><a href="https://jestjs.io/docs/expect#expectvalue">expect bir jest fonksiyonudur</a> ve içine test edilecek değeri alır. Buna göre ilk olarak senaryomuza göre user form’un bulunduğu div’i yakalıyoruz. Bunu daha önce bahsettiğim gibi <strong>wrapperların</strong> bizler için sağladığı özel fonksiyonlar vasıtasıyla gerçekleştiriyoruz. Bu testimizde ilgili yardımcı <strong>find()</strong> olmaktadır. Find içine bir CSS attribute vererek ilgili user-formunun bulunduğu div’i yakalayabiliyoruz. <a href="https://css-tricks.com/almanac/selectors/a/attribute/">CSS Attribute selector nasıl çalışıyor bilmiyorsanız buraya tıklayarak öğrenebilirsiniz.</a></p><pre>shallowWrapper.find(&quot;[data-test=\&quot;user-form\&quot;]&quot;)</pre><p>Div bu adımda bulundu. Sırada beklenen değerin expect içinde iddia edilmesi gerekmektedir. Ve bu iddia sonrasında doğrulanmalıdır. <strong>toBe</strong> tam olarak bu doğrulamanın yapılması için bize yardım eden araçtır. Eğer ki <strong>isAdmin:false</strong> ise git ilgili div’i bul ve onun içindeki yazının (toBe) “User Form Design” olmasını bekle.(expect)</p><pre>expect(shallowWrapper.find(&quot;[data-test=\&quot;user-form\&quot;]&quot;).text())<br>            .toBe(&quot;User Form Design&quot;)</pre><p>Şimdi ise isAdmin:true ile prop binding yapılırsa testimizin ne şekilde yazılması gerektiğini konuşalım. Yukarıdaki testin altına bu durumun testini ekleyelim.</p><pre>test(&quot;should render admin form&quot;,() =&gt; {<br>    <em>const </em>shallowWrapper = shallowMount(LoginForm, {<br>        propsData: {<br>            isAdmin: <em>true<br>        </em>}<br>    })<br>    expect(shallowWrapper.find(&quot;[data-test=\&quot;admin-form\&quot;]&quot;).text())<br>        .toBe(&quot;Admin Form Design&quot;)<br>})</pre><p>Burada farklı olan ilk olarak <strong>isAdmin: true</strong> olarak bind edilir. Eğer bu şekilde bind edildi ise benim kontrol etmem gereken şey admin formunun düzgün bir şekilde render edilip edilmediğidir. Bunun için yapmam gereken sadece expect içinde <strong>data-test değerinin ‘admin-form’ olarak değiştirilmesi ve beklenen değerin “Admin Form Design” olarak doğrulanması </strong>olayıdır. <a href="https://github.com/atakanteko/medium-vue-test-utils/commit/ef0a86659ebd706c0fb825134b910f838e35ce0f">İncelediğimiz örneğe takip eden linke tıklayarak ilgili commit’i inceleyerek bakabilirsiniz.</a></p><h4>Factory Function</h4><p>Şimdiye kadar yazılan testlerde component mount ve props işlemlerini tekrar tekrar yazmak durumunda kaldık. Bundan sonra kod tekrarı yapmamak adına factory function kullanacağız. Bu tamamen mantıksal bir yaklaşım ve DRY prensibini uygulamak adına kullanacağımız bir yöntem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/414/1*aBqZ7-cS8_5gq8Cponfevw.png" /></figure><p>Props testing örneğimizi bu mantıksal yaklaşım ile tekrar yazalım. Yukardaki kodlara göz attığımızda tekrar eden kısımların mount component ve props binding işlemleri olduğunu fark etmişsinizdir. Bunların hepsini factory function içinde toplayabiliriz.</p><pre>describe(&quot;Props Data Testing&quot;, () =&gt; {<br>    <em>const </em>factory = (options) =&gt; {<br>        <em>return </em>mount(LoginForm, {<br>            propsData: {<br>                ...options<br>            }<br>        })<br>    }<br>    test(&quot;should render user form&quot;,() =&gt; {<br>        <em>const </em>params = {isAdmin: <em>false</em>}<br>        <em>const </em>shallowWrapper = factory(params)<br>        expect(shallowWrapper.find(&quot;[data-test=\&quot;user-form\&quot;]&quot;).text())<br>            .toBe(&quot;User Form Design&quot;)<br>    })<br>    test(&quot;should render admin form&quot;,() =&gt; {<br>        <em>const </em>params = {isAdmin: <em>true</em>}<br>        <em>const </em>shallowWrapper = factory(params)<br>        expect(shallowWrapper.find(&quot;[data-test=\&quot;admin-form\&quot;]&quot;).text())<br>            .toBe(&quot;Admin Form Design&quot;)<br>    })<br>})</pre><p>Artık mount işlemini factory fonksiyonu ile yapıyor ve dahası ilerde test edilecek hedef component’in test edilecek kısımlarının (store,computeds, methods…) tek bir noktadan hızlı bir şekilde yönetilebilmesini sağladık. Takip eden bağlantıya tıklayarak ilgili commit’i inceleyebilirsiniz. <a href="https://github.com/atakanteko/medium-vue-test-utils/commit/a3188f1a24665a01c47705008af9cc0e19c82c8c">(Factory Function)</a></p><p>Bu bölümde ne öğrendik?</p><ul><li>test için kullanılacak olan props’ların propsData ile nasıl set edileceği</li><li>DRY prensibine uygun test yazabilmeyi</li></ul><p>Bunlara ek olarak propsData yerine setProps’da kullanılabilmektedir. Daha detaylı bilgi için takip eden bağlantıya gidebilirsiniz.<a href="https://vue-test-utils.vuejs.org/api/wrapper-array/#setprops">(setProps)</a></p><h3>Testing Computed Properties</h3><p>Computed test işlemi oldukça kolaydır. Çünkü herhangi bir JavaScript fonksiyonundan farkı yoktur.</p><p>Senaryomuza göre yaşı 18&#39;den küçük olan bir kişinin sistemimize üye olmasını engellemek isteyelim. Kullanıcı yaşını girsin ve kayıt ol butonuna tıkladığında ise bir uyarı açılsın ve içinde ‘Yaşınız 18’den küçük olduğu için sistemimize kayıt işleminiz gerçekleştirilememiştir.’ yazsın. Buna göre test işlemlerimizi gerçekleştirelim.</p><pre>&lt;template&gt;<br>  &lt;div&gt;<br>    &lt;h1 <em>v-if</em>=&quot;checkAge&quot; <em>data-test</em>=&quot;warning&quot;&gt;Yaşınız 18&#39;den küçük olduğu için sistemimize kayıt işleminiz gerçekleştirilememiştir.&lt;/h1&gt;<br>    &lt;h1 <em>v-else</em>&gt;Kayıt başarılı bir şekilde gerçekleşmiştir.&lt;/h1&gt;<br>  &lt;/div&gt;<br>&lt;/template&gt;<br><br>&lt;script&gt;<br><em>export default </em>{<br>  name: &#39;ComputedComponent&#39;,<br>  props: {<br>    age: {<br>      type: Number,<br>    },<br>  },<br>  computed: {<br>    checkAge() {<br>      <em>return this</em>.age &lt; 18;<br>    }<br>  },<br>};<br>&lt;/script&gt;</pre><p>Şimdi bu componentimizi test edelim.</p><p>computed içinde checkAge isimli property eğer ki age &lt; 18 ise true döner ve &lt;h1&gt; etiketi içinde ilgili mesaj yazdırılır. Adımlarımız belli oldu.</p><ul><li>component’i mount et</li><li>mount ederken age isimli prop gönder</li><li>hedef computed’i çalıştır</li><li>dönen değerin true olduğunu doğrula</li><li>sonrasında hata mesajının yazdırıldığı h1 etiketini yakala</li><li>yakaladığın etiket arasında mesajın yazdırıldığını doğrula</li></ul><p>Yukarıdaki adımlara göre testimizi yazarsak aşağıdaki sonucu elde ederiz.</p><pre><em>import </em>{ mount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>Computed <em>from </em>&quot;../../src/components/Computed/Computed&quot;;<br><br>describe(&quot;Computed Properties Testing&quot;, () =&gt; {<br>    <em>const </em>factory = (options) =&gt; {<br>        <em>return </em>mount(Computed, {<br>            propsData: {<br>                ...options<br>            }<br>        })<br>    }<br>    test(&quot;should see warning form&quot;,() =&gt; {<br>        <em>const </em>params = {age: 17}<br>        <em>const </em>wrapper = factory(params)<br>        expect(wrapper.vm.checkAge).toBeTruthy()<br>        <em>const </em>warning = wrapper.find(&quot;[data-test=\&quot;warning\&quot;]&quot;)<br>        expect(warning.text()).toEqual(&#39;Yaşınız 18\&#39;den küçük olduğu için sistemimize kayıt işleminiz gerçekleştirilememiştir.&#39;)<br>    })<br>})</pre><p>Ne yaptığımızı anlatmaya başlayalım.</p><p>İlk olarak zaten bildiğimiz prop gönderme işlemini yapıyoruz. Sonrasında checkAge isimli computed’i tetiklemem lazım<strong>. Bunun için yine wrapper object’in yardımcı araçlarından vm’i kullanabilirim.</strong></p><p><strong>Her Vue component’i bir Vue instance’sidir. Bu instance’ye referans eden ise vm ( view model ) değişkenidir. Ve bu referans aracılığı ile Vue component’i içinde istediğim noktaya ulaşabilirim. Bu şekilde checkAge computed’i tetikliyorum.</strong></p><p>Sonrasında ise ilgili h1 etiketini bulup içindeki mesajın doğruluğunu test ederek işlemimi tamamlıyorum.</p><p>Bu bölümde ne öğrendik?</p><ul><li>computed property nasıl test edilir</li><li>vm nedir ve nasıl kullanılabilir</li></ul><p><a href="https://github.com/atakanteko/medium-vue-test-utils/commit/fa1ead6215b03bb5eedaca84b067e07e5bc693ca">Bu bağlantıya tıklayarak örnekte yapılan işlemleri inceleyebilirsiniz.</a></p><h3>Testing Emitted Events</h3><p>Projeler büyüdükçe componentler arası veri aktarımı da artıyor. <a href="https://v2.vuejs.org/v2/guide/components-custom-events.html">Parent component child component’e veri aktarımını prop aracılığı ile yapıyorken tam tersi işlem ise emitted eventler aracılığı ile gerçekleşmektedir.</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*I8n7KtVylbmkC0ScT9BVYQ.png" /></figure><p>Vue Test Utils emitted eventlerin test edilmesi için ‘<strong><em>emitted API</em></strong>’ ile bize destek vermektedir. (<a href="https://vue-test-utils.vuejs.org/api/wrapper/emitted.html">emitted</a>)</p><h4>emitted syntax</h4><p>Öncelikle emitted ne şekilde çalışır bunu öğrenerek başlayalım. Bunun için aşağıdaki örneğe ve çıktısına bakalım.</p><pre>&lt;template&gt;<br>  &lt;h1&gt;Emitter Component&lt;/h1&gt;<br>&lt;/template&gt;<br><br>&lt;script&gt;<br><em>export default </em>{<br>  name: &quot;EmitterComponent&quot;,<br>  methods: {<br>    emitMyEvent() {<br>      <em>this</em>.$emit(&quot;sendNameAge&quot;, &quot;Alp&quot;, &quot;20&quot;)<br>    }<br>  }<br>}<br>&lt;/script&gt;</pre><p>Görüldüğü üzere bir isim ve yaş bilgisi emit edilmektedir.</p><pre><em>import </em>{ mount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>Emitter <em>from </em>&quot;../../src/components/Emitter/Emitter&quot;;<br><br>describe(&quot;Emits an event testing&quot;, () =&gt; {<br>    <em>const </em>factory = () =&gt; {<br>        <em>return </em>mount(Emitter)<br>    }<br>    test(&quot;emits and event with parameters&quot;,() =&gt; {<br>        <em>const </em>wrapper = factory()<br>        wrapper.vm.emitMyEvent()<br>        console.log(wrapper.emitted())<br>    })<br>})</pre><p>Şimdi test dosyasını inceleyelim.</p><pre>console.log(wrapper.emitted())</pre><p>satırı bize wrapper object aracılığıyla sunulan bir özelliktir<strong><em>. Burda bilinmesi gereken en önemli unsur emitted’in bir object döndürdüğüdür.</em></strong> Bu test dosyasının çıktısına bakacak olursak daha net anlayacağız.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*qr3B2TVyrB5-LWOSaxdWIw.png" /></figure><p><strong>Görüldüğü üzere emitted bir object döndürür ve içinde emit edilen event’in ismi ve buna atanmış bir dizi ve bu dizinin içinde ise gönderilmek istenen parametreler yine bir dizinin elemanları olarak bulunur.</strong></p><p>Yukarıdaki bilgiye dayanarak şu işlemlerin ne sonuç verdiğine bakalım.</p><pre>console.log(wrapper.emitted().sendNameAge);</pre><ul><li>[ [ ‘Alp’, ‘20’ ] ]</li></ul><pre>console.log(wrapper.emitted().sendNameAge[0]);</pre><ul><li>[ ‘Alp’, ‘20’ ]</li></ul><pre>console.log(wrapper.emitted().sendNameAge[0][0]);</pre><ul><li>Alp</li></ul><pre>console.log(wrapper.emitted().sendNameAge[0][1]);</pre><ul><li>20</li></ul><p>emitted nasıl ve ne şekilde kullanılır öğrendiğimize göre şimdi test işlemini yapabiliriz.</p><pre><em>import </em>{ mount } <em>from </em>&quot;@vue/test-utils&quot;<br><em>import </em>Emitter <em>from </em>&quot;../../src/components/Emitter/Emitter&quot;;<br><br>describe(&quot;Emits an event testing&quot;, () =&gt; {<br>    <em>const </em>factory = () =&gt; {<br>        <em>return </em>mount(Emitter)<br>    }<br>    test(&quot;emits and event with parameters&quot;,() =&gt; {<br>        <em>const </em>wrapper = factory()<br>        wrapper.vm.emitMyEvent()<br>        expect(wrapper.emitted().sendNameAge[0]).toEqual([&quot;Alp&quot;, &quot;20&quot;])<br>    })<br>})</pre><p>Öğrendiğimiz bilgileri kullanarak bir assertion işlemini gerçekleştirmiş olduk. <a href="https://github.com/atakanteko/medium-vue-test-utils/commit/f3a4e73bc82490050aedcbcad1db08467516490e">Bu örneği incelemek için ilgili commit’e gidebilirsiniz.</a></p><p>Sonraki yazımda mocking global objects, triggering events —user input, mocking a HTTP Client — Axios gibi konulara değineceğim.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec7a4543f245" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/vue-test-utils-k%C4%B1lavuzu-ec7a4543f245">Vue Test Utils Kılavuzu</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Give Feedback in an Affirmative Way?]]></title>
            <link>https://medium.com/modanisa-engineering/how-to-give-feedback-in-an-affirmative-way-a8ee029f0daa?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/a8ee029f0daa</guid>
            <category><![CDATA[feedback-management]]></category>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[feedback]]></category>
            <dc:creator><![CDATA[Mehmet Tevfik Yüksel]]></dc:creator>
            <pubDate>Mon, 31 Jan 2022 06:38:30 GMT</pubDate>
            <atom:updated>2022-01-31T06:38:30.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZtfimBiICA6MDuH8It5cKA.png" /><figcaption><a href="https://www.freepik.com/photos/business">Business photo created by Racool_studio — www.freepik.com</a></figcaption></figure><p>Self-improvement. It is the most essential motive that a person working in the IT industry should have. Feedback is one of the most important parameters that support personal development. Receiving and giving feedback will enhance you and your team. However, incorrect feedback affects negatively the motivation of your team as well as yours.</p><h4><strong>What are Feedback and Feedback Session?</strong></h4><p><strong>Feedback</strong>, with the shortest definition, is “any information and notification that is given back to a person by the system or team-mates regarding to his/her situation and action.” The main purpose of giving feedback is to <strong>identify</strong> <strong>shortcomings</strong>, and then <strong>correct</strong> and <strong>develop</strong> them.</p><p><strong>Feedback Session</strong> is an event implemented by companies, teams, or communities, where everyone gives feedback to each other periodically (once a month, twice a year, etc.). During the session, <strong>scores</strong> can also be given to people based on certain criteria. In some communities, earnings of individuals (bonus, benefits, salary, etc.) can be determined through these session scores.</p><h4><strong>What is the purpose of Feedback?</strong></h4><p>Let’s think like an engineer and proceed with an <strong>output-oriented approach</strong>. What are our <strong>expectations</strong> and <strong>acceptance criteria</strong> after giving feedback? It is important to analyze this point correctly because all of the items listed in the rest of this article will actually be trying to create this output.</p><blockquote><strong>Acceptance Criteria (The Expected Output):</strong> Increased motivation and productivity. 💪</blockquote><p>So, what is the main purpose of feedback?</p><blockquote>The main purpose of Feedback is to reveal the <strong>shortcomings</strong> of a person/team, to create the necessary motivation to overcome these shortcomings, and finally to ensure that the person/team approaches the <strong>optimum</strong> <strong>level</strong>.</blockquote><p>As a matter of fact, when the person/team develops enough to provide maximum <strong>efficiency</strong>, the output of the work will become equally efficient. But, wrong feedback, which deviates from its purpose, can <strong>destroy</strong> the <strong>happiness</strong> of your team and your favorite work environment.</p><p>💎 As a summary of the whole article, just filter your feedback ideas with the <strong>super-secret filters</strong> below (your answer should be <strong>yes</strong> to all of them):</p><ul><li>Will it contribute to the development of the person/team?</li><li>Is it repetitive and fixable behavior?</li><li>Does it not criticize personal characteristics?</li></ul><h4><strong>Use friendly language, positive sentences.</strong></h4><p>Being constructive always leaves more positive impressions on you. You should avoid imperative moods and scornful attitudes.</p><p>Instead of saying, “<em>If you interrupt people, productivity decreases, don’t do that</em>” you may say, “<em>We can wander off from the topic when someone interrupts while we are discussing an important issue. If you pay attention to this point, we can work more efficiently.</em>”</p><p>As a result of both sentences, your friend will understand that interrupting people is a problem. However, the person will <strong>lose motivation</strong> with the thought of <strong><em>“I am reducing productivity</em></strong>” with the first sentence, he/she will be motivated with the thought that “<strong><em>I will increase productivity</em></strong>” with the second sentence.</p><h4><strong>Don’t blame/point the person. Use “I” rather than “you”.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2DypugEMHPGq0eccR0yt4g.png" /><figcaption><a href="https://www.freepik.com/photos/people">People photo created by wayhomestudio — www.freepik.com</a></figcaption></figure><p>Do not pretend to be the parent of the person you are giving feedback to. Give feedback to your teammates without looking hierarchically. Be a friend, not a politician. Never blame.</p><p>If you are going to do due diligence, it may be a better choice to convey the same main idea in a way that criticizes yourself.</p><p>Let’s take a look at the following feedbacks with the same main idea:</p><ul><li><strong>Feedback 1: </strong>You can be very hurtful.</li><li><strong>Feedback 2:</strong> Sometimes I can misunderstand you and get hurt</li></ul><p>If we empathize with both sentences, we can see what the difference in sentence structure can lead to:</p><ul><li><strong>Empathy 1: </strong>Am I really offending people? I’m so sorry for being a hurtful person. How wrong I was. What if I break someone again? From now on, I have to think about it in every step I take.</li><li><strong>Empathy 2:</strong> Actually, I am not a hurtful person. Sometimes people misunderstand me. I should be more careful not to be misunderstood.</li></ul><p>As a result of the first feedback, your friend will <strong>lose motivation</strong> and will start to weigh every word he/she speaks and every behavior he/she does. Your friend may feel <strong>guilty</strong>, and if he/she is an emotionally sensitive person, may even lose his/her sense of belonging to the team.</p><p>As a result of the second feedback, your friend will be <strong>motivated</strong>, not feel guilty, and will make an effort to improve himself.</p><p>Choose the second. Although you know that it is not your fault, our acceptance criteria (feedback output) was that our friend was motivated and mistakes were corrected, right?</p><h4><strong>Do not criticize personal characteristics.</strong></h4><p>Don’t be a therapist or psychologist. Do not criticize points such as personal characteristics, life preferences, speaking style, temperament, private life, the belief that do not affect your business relationship or technical partnership.</p><p>Empathize, no one can change their innate temperament and the values ​​they believe in after a criticism. Don’t expect it to change.</p><p>In addition, this type of criticism is extremely dangerous for culture. When this type of feedback is given, the person will make an effort to act against his temperament, will be under stress, and will experience a loss of work motivation.</p><p>The point of Feedback was to <strong>motivate</strong> and <strong>move forward</strong>, right? Not losing that person!</p><h4><strong>Do not use “but”.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*_4LAsiaZULoMUN3O6hmJnw.gif" /></figure><p>The word “but” is magical. It <strong>destroys</strong> all positive propositions that come before it in the sentence. When you list great features and connect them with but, all the positive things you listed <strong>evaporate</strong>. The focus shifts entirely to the second part of the sentence.</p><p>Separate the sentences. Instead of saying, “<em>You are great in these subjects, but it would be better if you improve these subjects</em>”, say “<em>You are great at these subjects. It would be better if you develop this subject as well.</em>”</p><h4><strong>Do not criticize momentary, one-off events.</strong></h4><p>We are all human, we can make mistakes. Everyone can have bad days, try to be understanding. Ignore one-time errors. Discuss general, <strong>established</strong> behavior. If you’re going to use sentences beginning with “once”, think twice.🙂</p><h4>Do not tell others about your private memories with that person.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*a_H_6i3jGNsyvpbh79_dJA.jpeg" /><figcaption><a href="https://www.freepik.com/photos/woman">Woman photo created by azerbaijan_stockers — www.freepik.com</a></figcaption></figure><p>If you are trying to reach an opinion about a person as a team and give collective feedback; do not share private things (positive or negative) with the team other than your business relationship with that person.</p><h4><strong>Don’t wait until the Feedback Session. Communicate simple things promptly.</strong></h4><p>It is important to take quick action for small problems. A problem that is not intervened early can grow and come to you. Don’t wait for feedback session time to talk about them. Share these topics without waiting, by having a one-to-one conversation.</p><h4>Clearly state your opinions for your feedbacks<strong>.</strong></h4><p>Regardless of whether your score is low or high, share both the shortcomings and the positive aspects of the person. Hearing good things motivates everyone.</p><h4><strong>Be result-oriented, emphasize areas to be improved.</strong></h4><p>Your focus when giving feedback should always be to see the other person’s shortcomings and improve them. Our ultimate goal is to elevate our team culture. We should be able to tell people about their shortcomings in an appropriate manner and positively contribute to their self-development.</p><p>I would like to end the article by reminding the acceptance criteria that all the topics I mentioned above try to provide:</p><blockquote><strong>Acceptance Criteria (The Expected Output):</strong> Increased motivation and productivity. 💪</blockquote><p>Feel free to give feedback to me. But first, read this article one more time 🙂.</p><p>Stay with code! 👨‍💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8ee029f0daa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/how-to-give-feedback-in-an-affirmative-way-a8ee029f0daa">How to Give Feedback in an Affirmative Way?</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mobile App Acceptance Testing using JavaScript on Local & BrowserStack Environments with WebDriver.I]]></title>
            <link>https://medium.com/modanisa-engineering/mobile-app-acceptance-testing-with-javascript-on-browserstack-with-webdriver-io-appium-50d151d03843?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/50d151d03843</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Muhammed İKİNCİ]]></dc:creator>
            <pubDate>Tue, 11 Jan 2022 07:24:25 GMT</pubDate>
            <atom:updated>2022-01-11T07:29:35.316Z</atom:updated>
            <content:encoded><![CDATA[<h3>Mobile App Acceptance Testing using JavaScript on Local &amp; BrowserStack Environments with WebDriver.IO &amp; Appium 🚀</h3><blockquote>Acceptance testing is the process of verifying that stories were developed such that each works exactly the way the customer team expected it to work.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Q9VdTFZIsNDGVUrjHW09gQ.png" /><figcaption>Appium — JavaScript — Webdriver.IO — BrowserStack</figcaption></figure><p><strong>First of all, you must have installed all android environments</strong>. (Android Studio etc)</p><p>Hello, In this article, we will dive into mobile application testing. Before starting the tests, I would like to explain which technologies we will use and what they do.</p><p>ℹ️ TL&amp;DR: <a href="https://github.com/muhammedikinci/wdio-appium-browserstack">https://github.com/muhammedikinci/wdio-appium-browserstack</a></p><h3>👉 <strong>WebDriver.IO</strong></h3><blockquote><a href="https://webdriver.io/">WebDriver.IO is a browser and mobile automation test framework.</a></blockquote><p>Also, WebDriver.IO can work with any test tool using <a href="https://webdriver.io/docs/api/jsonwp/">JSON-Wire Protocol</a> (BrowserStack, Appium). In this project, WebDriver.IO will manage our test scripts.</p><h3>👉 <strong>Appium</strong></h3><blockquote><a href="https://appium.io/">Appium is an open source test automation framework for use with native, hybrid and mobile web apps.</a></blockquote><p>Appium server and services will help us to our test scripts communicate with the app.</p><h3>👉 Boilerplates</h3><p>If you already know these technologies and just want a quick and safe solution, you can check repositories as specified below;</p><ul><li><a href="https://github.com/webdriverio/appium-boilerplate">GitHub - webdriverio/appium-boilerplate: Boilerplate project to run WebdriverIO tests with Appium to test native applications on iOS and Android</a></li><li><a href="https://github.com/webdriverio/cucumber-boilerplate">GitHub - webdriverio/cucumber-boilerplate: Boilerplate project to run WebdriverIO tests with Cucumber</a></li></ul><h3>Setup From Scratch</h3><h4>👉 Installing Modules</h4><p>Let’s start by creating our working directory, then go to the directory and start WebDriver.IO</p><pre>mkdir webdriverio-test<br>cd webdriverio-test<br>yarn create wdio .</pre><p>After installing the dependencies, the WDIO Configuration Helper asks us some questions. You can choose the options as shown below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ndBw7JK_Tu_DOy1sSfxk0A.png" /><figcaption>WDIO Configuration Helper — Selected Options</figcaption></figure><blockquote>For some questions like “Service” you can select multiple options with space. (BrowserStack and Appium)</blockquote><h4>👉 Inspect Elements</h4><p>We will use <a href="https://github.com/appium/appium-inspector/releases">Appium Inspector</a> to see elements in the application and <a href="https://github.com/appium/appium/blob/master/sample-code/apps/ApiDemos-debug.apk">the API Demos APK</a> for test purpose.</p><p>Open Appium Inspector and Android Device. Drag and drop APK to Emulator for installing the application. We enter capabilities for connecting to the Emulator from Appium Inspector you can go over <a href="https://appium.io/docs/en/writing-running-appium/caps/">this documentation</a>.</p><p>Add the following capabilities to JSON Representation in Appium Inspector and click the save button;</p><pre>{<br>  &quot;platformName&quot;: &quot;Android&quot;,<br>  &quot;platformVersion&quot;: &quot;11.0&quot;,<br>  &quot;automationName&quot;: &quot;UIAutomator2&quot;<br>}</pre><p>Before starting to inspect the element we need to install Appium globally and start Appium server in our local machine. Enter below commands to the terminal;</p><pre>yarn global add appium<br>appium -pa /</pre><p>Return Appium Inspector interface and click to “Start Session”. You will see a screen like the one below. Now we can get the required selectors from here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4MgwcX4pP6Jru1wk-KvjA.png" /></figure><h4>👉 Creating Our First Test Features</h4><p>Open the project and create the files and directories all shown below.</p><pre>- features<br>  - step-definitions<br>    - steps.js<br>  - test.feature</pre><p>Write the below codes for the created files;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2de52514355f4bfc6619b9ff34edb2ab/href">https://medium.com/media/2de52514355f4bfc6619b9ff34edb2ab/href</a></iframe><h4>👉 Defining Configurations</h4><p>Now we create a new WDIO configuration file and override some properties for local and BrowserStack environments. Create “wdio.local.conf.js” and write the below codes then move ApiDemos APK to in the same directory with “wdio.local.conf.js”;</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac223c44cffd74ff7d5770bfea9a0369/href">https://medium.com/media/ac223c44cffd74ff7d5770bfea9a0369/href</a></iframe><h4>👉 Running Tests on Local</h4><p>For running tests on the local we can add this code to “scripts” in package.json and run.</p><pre>&quot;wdio:local&quot;: &quot;wdio run wdio.local.conf.js&quot;</pre><pre>yarn wdio:local</pre><p>The test result must be below;</p><pre>[emulator-5554 Android 11 #0-0] » \features\test.feature<br>[emulator-5554 Android 11 #0-0] Test the attributes of a given element<br>[emulator-5554 Android 11 #0-0] Write to EditText<br>[emulator-5554 Android 11 #0-0]    ✓ Given Click to &#39;Views&#39; text<br>[emulator-5554 Android 11 #0-0]    ✓ Given Click to &#39;Auto Complete&#39; text<br>[emulator-5554 Android 11 #0-0]    ✓ Given Click to &#39;1. Screen Top&#39; text<br>[emulator-5554 Android 11 #0-0]    ✓ Then Write to text<br>[emulator-5554 Android 11 #0-0]<br>[emulator-5554 Android 11 #0-0] 4 passing (6.3s)</pre><pre>Spec Files:      1 passed, 1 total (100% completed) in 00:00:20</pre><pre>2022-01-10T19:58:46.999Z INFO <a href="http://twitter.com/wdio/local-runner">@wdio/local-runner</a>: Shutting down spawned worker<br>2022-01-10T19:58:47.255Z INFO <a href="http://twitter.com/wdio/local-runner">@wdio/local-runner</a>: Waiting for 0 to shut down gracefully<br>2022-01-10T19:58:47.256Z INFO <a href="http://twitter.com/wdio/local-runner">@wdio/local-runner</a>: shutting down</pre><h4>👉 Running Test on BrowserStack</h4><p>In this step, we must upload our APK to BrowserStack and get APPID. We provide APPID in the configuration file.</p><p>For upload apk;</p><pre>curl -u &quot;&lt;username&gt;:&lt;access_token&gt;&quot; -X POST &quot;<a href="https://api-cloud.browserstack.com/app-automate/upload">https://api-cloud.browserstack.com/app-automate/upload</a>&quot; -F &quot;file=@./ApiDemos-debug.apk&quot;</pre><p>Then we get result like this:</p><pre>{&quot;app_url&quot;:&quot;bs://id&quot;}</pre><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9205a17fe43d03f1521db55d3cd8650/href">https://medium.com/media/c9205a17fe43d03f1521db55d3cd8650/href</a></iframe><p>For running tests on the BrowserStack we can add this code to “scripts” in package.json and run.</p><pre>&quot;wdio:browserstack&quot;: &quot;wdio run wdio.browserstack.conf.js&quot;<br>yarn wdio:browserstack</pre><p>And see the results on BrowserStack dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lqr0lZ8SCk0SAXVWAh_ZVA.png" /></figure><p>TL&amp;DR: <a href="https://github.com/muhammedikinci/wdio-appium-browserstack">https://github.com/muhammedikinci/wdio-appium-browserstack</a></p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2F3oEdva9BUHPIs2SkGk%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2F3oEdva9BUHPIs2SkGk%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExOXh4a2htcjMzODNoNzJjZGlvZDIxM2hnc2ZsOWhtZ2hzbGRkYW5naiZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw%2F3oEdva9BUHPIs2SkGk%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="435" frameborder="0" scrolling="no"><a href="https://medium.com/media/e7de1ed3519b8fa9c59ef3066525671c/href">https://medium.com/media/e7de1ed3519b8fa9c59ef3066525671c/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50d151d03843" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/mobile-app-acceptance-testing-with-javascript-on-browserstack-with-webdriver-io-appium-50d151d03843">Mobile App Acceptance Testing using JavaScript on Local &amp; BrowserStack Environments with WebDriver.I</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to add k6 load test to Gitlab CI pipeline with AWS Lambda Containers]]></title>
            <link>https://medium.com/modanisa-engineering/how-to-add-k6-load-test-to-gitlab-ci-pipeline-with-aws-lambda-containers-2096278d5711?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/2096278d5711</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[lambda]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Murat turan]]></dc:creator>
            <pubDate>Mon, 10 Jan 2022 05:43:40 GMT</pubDate>
            <atom:updated>2022-01-10T10:32:27.061Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>A great way to ensure both consistency and accuracy is to automate everything the team does</blockquote><p><strong>Pipelines</strong> are so important to Modanisa team. We are automating the things that can be automated. Imagine a pipeline including memory leak tests, CSS-regression tests and load tests. This tutorial makes you implement a load test job in your pipeline.</p><p>What we are going to do? Here is the simple schema of the tutorial. As you guys can see there are two-part. One of them is load testing to the target and the other part is visualize of outputs but <a href="https://www.influxdata.com/">influxdb</a> and <a href="https://grafana.com/">Grafana</a> setups are not included because easily can find tutorials on google.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gaZ_XwbyXv9B-5Hi_R3vAg.png" /><figcaption>s</figcaption></figure><p><strong>¿? Why is Lambda? </strong><br>It’s Serverless. Decide what to do with your code and let AWS make it server-side with minimized cost.</p><p><strong>¿? Why </strong><a href="https://www.influxdata.com/"><strong>influxdb</strong></a><strong>? Actually, what is influxdb?</strong></p><blockquote>InfluxDB is an open-source time series database (TSDB) developed by the company InfluxData. It is written in the Go programming language for storage and retrieval of time series data in fields such as operations monitoring, application metrics, Internet of Things sensor data, and real-time analytics.</blockquote><p><strong>¿? Why </strong><a href="https://github.com/GoogleContainerTools/kaniko"><strong>kaniko</strong></a><strong>?</strong></p><blockquote>Kaniko is a tool to build container images from a Dockerfile inside a container or Kubernetes cluster. Kaniko doesn’t depend on a Docker daemon and executes each command within a Dockerfile completely in user space. This enables building container images in environments that can’t easily or securely run a Docker daemon such as a standard Kubernetes cluster.</blockquote><h4>⚡️ Let’s start ️⚡️</h4><h3>1) Lambda container Dockerfile 🐳</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc4f2904ed1cd6b23d069d36c5f5a80a/href">https://medium.com/media/cc4f2904ed1cd6b23d069d36c5f5a80a/href</a></iframe><p>It’s a simple Dockerfile including k6 binaries but last line can be interesting. Here is the explanation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*9uCSsZmgPMPwOuaoK2QZIg.png" /></figure><p>You can run that Dockerfile on your local. But if you run it as a docker container, it doesn’t run that exported function. There is a way to trigger exported function below with payload.</p><pre>curl -XPOST &quot;http://localhost:8080/2015-03-31/functions/function/invocations&quot; -d &#39;{&quot;payload&quot;:&quot;hello world!&quot;}&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F6neT-I5oU0u7xQf_GAqJw.png" /><figcaption>An example output of basic console.log app when trigger with curl</figcaption></figure><h3>2 ) The function inside Lambda container</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74417c05a65d0a0b093a41d53314dad2/href">https://medium.com/media/74417c05a65d0a0b093a41d53314dad2/href</a></iframe><p>If you want to start testing with a test configuration, should write <strong>k6 run </strong><a href="https://k6.io/docs/examples/single-request"><strong>spec.file.js</strong></a><strong> </strong>to console and all is done. k6 will initialize itself and will run the test spec file and then shows the result of the test.</p><p><strong>In our case,</strong> we have k6 binaries on docker container. We can send commands like <strong>k6 run </strong>with <a href="https://nodejs.org/api/child_process.html#child_processspawncommand-args-options">spawn</a> or <a href="https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback">exec</a>. These are built-in node js packages.</p><p>The function <strong>has to wait</strong> until the completion of the execution k6 process. It is important because the lambda container lives until the function is complete. If the container dies the load test cannot be executed successfully.</p><p>Lambda functions take event parameters so the function of inside lambda container takes event parameters too. In code snippet, we have an event parameter and it has targetServiceName field to specify the test spec file to execute. Also, we can pass influxdb endpoint differently for every environment.</p><p><strong>k6 shows the result</strong> when the test is executed successfully. These lines also include if your thresholds fail or not, kind of assertion like is response time under 100ms or not? You can find more information on k6 <a href="https://k6.io/docs/using-k6/thresholds/">Thresholds docs</a> page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ovxJZFcbuuLHD410.png" /><figcaption>Example result output of k6</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/143/1*Myv-Bn3xeZ02_4U3mAJuCA.png" /></figure><p>Also, I want to show folder structure to understand last line of Dockerfile and clarify picking test spec file with the event.</p><h3>3) AWS ECR(Elastic Container Registry) Repo Create</h3><p><a href="https://eu-west-1.console.aws.amazon.com/ecr/repositories?region=eu-west-1">Navigate to ECR Dashboard</a> &gt; Private Tab &gt; Create Repository &gt; Pick a name &gt; Create Repository</p><p>Now we have a Container Registry URI. That will be used for hosting our containers and accessing from Lamba. We will paste it to Gitlab CI file which is mentioned below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nqKqf5MZjSF-4vJEXh-xNQ.png" /></figure><p>We just created a repo without any image. We need a published image because we will pick in lambda create wizard. Don’t worry it’s pretty easy.</p><p><strong>Click newly created ECR repo</strong> &gt; <strong>View Push Commands</strong></p><p>This helps us to publish an image to our ECR repo easily. We need to push the previously created Dockerfile to ECR.</p><h3>4) AWS Lambda Create</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*anmhJDFKtP6IkpGeBwOSYA.png" /><figcaption>Picking container image in Lambda creation wizard</figcaption></figure><p><strong>Create Function</strong> &gt; <strong>Select Container Image</strong> &gt; <strong>Pick a name</strong> &gt; <strong>Pick your image</strong> &gt; <strong>Create Function</strong></p><p>These steps make you create a Lambda with a container image. The last step is attaching vpc for accessing the internet.</p><p><strong>Select the Lambda Function newly created</strong> &gt; <strong>Configuration Tab </strong>&gt; <strong>VPC</strong> &gt; <strong>Edit</strong></p><p>Lambda needs to access internet access in some scenarios but some scenarios don’t need to access. In that case, <strong>obviously</strong>, it needs.</p><p>This wizard helps us to pick vpc, subnet and security group. If you don’t know these keywords, feel to free just default vpc, two subnet and default security group.</p><p>Note that lambda function name for Gitlab CI file.</p><h3><strong>5) Gitlab-CI file</strong></h3><p>There are 3 stages with <strong>an if statement</strong>. If someone commits to the load test repo package and lambdaDeploy will be executed by Gitlab CI. If another repo trigger that pipeline(as known <strong>Downstream</strong> keyword) with variable TARGET_SERVICE_NAME then only the load test job will be executed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f8bbdd74490a508a2b3e14dd5032986/href">https://medium.com/media/0f8bbdd74490a508a2b3e14dd5032986/href</a></iframe><p>By the way, this pipeline can work without if statements for a single repository. <strong>But imagine you have two services and one frontend repository. Easily trigger every commit the job without build and package job wait time and less code.</strong></p><p>Then add the load test snippet to<strong> the target repository</strong> for example it can be <strong>your service project’s pipeline</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/1*vbn_OELfRazdMW0v-gLZXQ.png" /></figure><p>There it is. We added a load test job to our Gitlab CI pipeline.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*EZV1kFhSv2XhLohv7Ht3yQ.png" /><figcaption>Easily integrate service repository</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*U_PCsv0E7TY82vw_CXnD5A.png" /><figcaption>Example Downstream repo with multiple load-test jobs 5 min with 4000 VU’s</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*KzMZK6HzaJpuabKAzyNEkw.png" /><figcaption>Example Downstream repo with multiple load-test jobs 5 min with 1000 VU’s</figcaption></figure><h3>💈 <strong>Visualize</strong> 💈</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*VUrVqL5Fr7yQct9xLmbhew.png" /><figcaption>Configure Data source</figcaption></figure><p>Let’s add our influxdb to grafana as data source and then import a ready-to-use k6 dashboard to our grafana.</p><p><strong>Grafana </strong>&gt; <strong>Configuration</strong> &gt; <strong>Data Sources</strong> &gt; <strong>Add data source</strong> &gt; <strong>Pick InfluxDB</strong><br>This page needs your influxdb’s URL, user, password and db name. The database name at image “k6db” was used at k6 run parameters above before.</p><p>The last step is importing the dashboard.</p><p><strong>Grafana </strong>&gt;<strong> Create</strong> &gt; <strong>Import</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*eXnp4SRS7-bQoxMyAOJs7Q.png" /><figcaption>Importing dashboard</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gAZL9381KTdyKiMV" /><figcaption>The Dashboard</figcaption></figure><h3>💰 Pricing 💰</h3><p>Heavily under development scenario with non-included free tier on Ireland region;</p><p>300 pipeline in a month &gt; 10 min &gt; 2 GB Ram = 6.14 USD<br>150 pipeline in a month &gt; 10 min &gt; 4 GB Ram = 6.00 USD</p><p>300 pipeline in a month &gt; 5 min &gt; 1 GB Ram = 1.50 USD<br>150 pipeline in a month &gt; 5 min &gt; 1 GB Ram = 0.75 USD</p><p><a href="https://calculator.aws/#/createCalculator/Lambda">Pricing reference</a></p><h3>⚔️ Tests and Constraints ⚔️</h3><p>There are two important constraints. Durations and Virtual User (VU’s) count.</p><p><strong>Durations</strong></p><p>AWS CLI lambda invoke command waits until lambda executions end so in these cases, can be 10 min. You will see a HTTP connection when you run with debugging <em>--debug</em> parameter. <strong>If this connection is long enough so it dies.</strong> What Amazon docs say;</p><pre>For functions with a long timeout, your client might be disconnected during synchronous invocation while it waits for a response. Configure your HTTP client, SDK, firewall, proxy, or operating system to allow for long connections with timeout or keep-alive settings. <a href="https://docs.aws.amazon.com/cli/latest/reference/lambda/invoke.html">Ref</a></pre><p>Tests run on our Kubernetes executor for GitLab Runner with default configuration about network connections. So lambda invoke command dies after 5 minutes but it works for 5 minutes(300 seconds). <strong>If we consider using it on the pipeline that durations are pretty cool.</strong></p><p><strong>Solution</strong></p><p><a href="https://docs.aws.amazon.com/lambda/latest/dg/invocation-async.html">Async invocation</a> can be helpful. CLI doesn’t wait for a response from executions. In that case, <strong>we can’t break the pipeline with threshold values</strong> because we don&#39;t have the response of k6 output. But we know the function name of lambda, we can try to dig the logs as like mentioned command then it returns JSON documents so we can use <a href="https://stedolan.github.io/jq/">jq</a> tool to parse.</p><pre>aws logs filter-log-events --log-group-name /aws/lambda/load-test <br>--start-time 1641500010000</pre><p>Another constraint is Virtual User count. Lambda supports max <strong>up to</strong> 1000 VU’s. It has some trouble handling even 1100 VU’s.</p><h3>⚖️ Results ⚖️</h3><pre>+------+--------------+----------+--------------+-----------+<br>| RAM  | Virtual User | Duration | Project      | Req count |<br>+------+--------------+----------+--------------+-----------+<br>| 1 GB | 1000 VU      | 5 min    | Go backend   | 150k-180k |<br>+------+--------------+----------+--------------+-----------+<br>| 1 GB | 1000 VU      | 5 min    | Vue frontend | 30k       |<br>+------+--------------+----------+--------------+-----------+<br>| 1 GB | 4000 VU      | 5 min    | Go backend   | 400k      |<br>+------+--------------+----------+--------------+-----------+<br>| 6 GB | 1000 VU      | 5 min    | Go backend   | 150k-180k |<br>+------+--------------+----------+--------------+-----------+<br>| 1 GB | 1000 VU      | 10 min   | Go backend   | 270k      |<br>+------+--------------+----------+--------------+-----------+</pre><blockquote>Simple tests will use ~1–5MB per VU. (1000VUs = 1–5GB). Tests that are using file uploads can consume tens of megabytes per VU. <a href="https://k6.io/docs/testing-guides/running-large-tests/">ref</a></blockquote><p>Also, I tried to understand how much GB is enough for a load test. 1 GB and 6 GB have some request count in our case.</p><p>Configuration with 6 GB:</p><pre>REPORT RequestId: 50b366c9–xxxx–xxxx-xxxx-a332d24b19a5 Duration: 303338.75 ms Billed Duration: 304099 ms Memory Size: 6000 MB Max Memory Used: 732 MB Init Duration: 760.19 ms</pre><p>Configuration with 1 GB;</p><pre>REPORT RequestId: 3b4ad8f4–xxxx–xxxx-xxxx-e6422e2d4e94 Duration: 309184.01 ms Billed Duration: 309185 ms Memory Size: 1024 MB Max Memory Used: 705 MB</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2096278d5711" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/how-to-add-k6-load-test-to-gitlab-ci-pipeline-with-aws-lambda-containers-2096278d5711">How to add k6 load test to Gitlab CI pipeline with AWS Lambda Containers</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Must Read Books for Product Management]]></title>
            <link>https://medium.com/modanisa-engineering/must-read-books-for-product-management-662bc75e159c?source=rss----197d03e79cce---4</link>
            <guid isPermaLink="false">https://medium.com/p/662bc75e159c</guid>
            <category><![CDATA[product-management]]></category>
            <category><![CDATA[product-development]]></category>
            <dc:creator><![CDATA[Büşra Emirli Demir]]></dc:creator>
            <pubDate>Mon, 03 Jan 2022 06:04:47 GMT</pubDate>
            <atom:updated>2022-01-03T06:20:20.470Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jfLjRHv_NsbqAM_tF4Km8Q.png" /><figcaption>Must Read Books for Product Management</figcaption></figure><p>Especially when I talk about product management at university events, at the end of the event, always question “Which books should I read?” is asked.<br>Or when someone in my around becomes interested in product management, “Which books should I read?” she/he asks.</p><p>These are the books that should be read by students, a recent graduates, those who want to be product owner / product manager, and those who want to switch to product management.</p><p>At Modanisa we have a curriculum for product owners:</p><p><strong>1- The Goal: A Process of Ongoing Improvement</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*qtTUDJbKRFRZ8nDESRmFvA.jpeg" /><figcaption>The Goal</figcaption></figure><p>First published in 1984, this book by <strong>Eliyahu M. Goldratt</strong> has been used as a textbook in more than 200 universities and business faculties.<br>Written in a fast-paced thriller style, ‘The Goal’ contains a serious message for all managers in industry and explains the ideas which underline the <strong>Theory of Constraints</strong> developed by the author.</p><p><strong>2- Thinking in Systems</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*BobGvrTrbZk4EsAH7zxvaw.jpeg" /><figcaption>Thinking in Systems</figcaption></figure><p><em>“Purposes are deduced from behavior, not from rhetoric or stated goals.”</em></p><p><em>“Keeping sub-purposes and overall system purposes in harmony is an essential function of successful systems.”</em></p><p><em>“An important function of almost every system is to ensure its own perpetuation.”</em></p><p>Meadows’ <em>Thinking in Systems</em>, is a concise and crucial book offering insight for <strong>problem solving</strong> on scales ranging from the personal to the global.<br>Donella Meadows readers to pay attention to what is <strong>important</strong>, not just what is <strong>quantifiable</strong>, to stay <strong>humble</strong>, and to stay a <strong>learner</strong>.</p><p><strong>3- The Phoenix Project</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*-0J7EMEDeu7swxIRswYOCw.jpeg" /><figcaption>The Phoenix Project</figcaption></figure><p>“<em>Obviously, he continues, “every work center is made up of four things: the machine, the man, the method, and the measures.”</em></p><p>In a fast-paced and entertaining style, three luminaries of the DevOps movement deliver a story that anyone who works in IT will recognize. Readers will not only learn how to improve their own IT organizations, they’ll never view IT the same way again.</p><p><strong>4- The Lean Startup</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*9WiNFBmKO-xxHVYo-QROjg.jpeg" /><figcaption>The Lean Startup</figcaption></figure><p>Most startups fail. But many of those failures are preventable. The Lean Startup is a new approach being adopted across the globe, changing the way companies are built and new products are launched.</p><p>Do one important thing: make better, faster business decisions. <strong>Vastly better, faster business decisions.</strong> Bringing principles from lean manufacturing and agile development to the process of innovation, the Lean Startup helps companies succeed in a business landscape riddled with risk.<br>This book shows you how.</p><p><strong>5- Running Lean</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*zWDXYqxB1WWiMZpa7NvL0g.jpeg" /><figcaption>Running Lean</figcaption></figure><p>I want to put a <strong>star</strong> next to this book. This is perhaps the most important book on this list.</p><p>At Modanisa, we want the candidate to read this book during the job interview process.</p><p>In this book you can find the following topics:</p><p>- Find a <strong>problem</strong> worth solving, then define a <strong>solution</strong></p><p>- Engage your customers throughout the development cycle</p><p>- Continually test your product with <strong>smaller, faster iterations</strong></p><p>- Build a feature, measure customer response, and <strong>verify</strong>/refute <strong>the idea</strong></p><p>- Know when to <strong>“pivot”</strong> by changing your plan’s course</p><p>- Maximize your efforts for <strong>speed, learning, and focus</strong></p><p>- Learn the ideal time to raise your <strong>“big round”</strong> of funding</p><p><strong>6- UX For Lean Startups</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*5vKz8n10_H4T33ucQk3Rtg.jpeg" /><figcaption>UX For Lean Startups</figcaption></figure><p>In this book you can find the following topics:</p><ul><li>Determine whether people will buy your product before you build it</li><li><strong>Listen</strong> to your customers throughout the product’s lifecycle</li><li><strong>Understand</strong> why you should design a test before you design a product</li><li>Get nine tools that are critical to designing your product</li><li>Discern <strong>the difference</strong> between necessary features and nice-to-haves</li><li>Learn how a <strong>Minimum Viable Product</strong> affects your UX decisions</li><li>Use <strong>A/B testing</strong> in conjunction with good UX practices</li><li>Speed up your product development process <strong>without sacrificing quality</strong></li></ul><p>Author’s video about this book:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMO3EmcDewY4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMO3EmcDewY4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMO3EmcDewY4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0dd4f4c0484ac7eb391e0fdec7244b7/href">https://medium.com/media/c0dd4f4c0484ac7eb391e0fdec7244b7/href</a></iframe><p><strong>7- Business Model Generation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*itcG9oZcPu9K7UTNxHaNlQ.jpeg" /><figcaption>Business Model Generation</figcaption></figure><p>“<em>Business Model Generation</em> is a handbook for visionaries, game changers, and challengers striving to defy outmoded business models and design tomorrow’s enterprises.”</p><p>Here is a video illustrating this book:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F-uifGqu3iRE%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D-uifGqu3iRE&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F-uifGqu3iRE%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1ddb1e95a1f2cf18f5997b789c55c6a7/href">https://medium.com/media/1ddb1e95a1f2cf18f5997b789c55c6a7/href</a></iframe><p><strong>8- The Agile Samurai</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*sRLyzdQYnjTMsoAm97om6g.jpeg" /><figcaption>The Agile Samurai</figcaption></figure><p>Enter the dojo of the agile samurai, where agile expert Jonathan Rasmusson shows you how to kick-start, execute, and deliver your agile projects.</p><p>By the end of this book you will know everything you need to set up, execute, and successfully deliver agile projects, and have fun along the way.</p><p><strong>9- User Stories Applied</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*vfX682_RgIPsBnM96vTSow.jpeg" /><figcaption>User Stories Applied</figcaption></figure><p>One star should also be added for this book.</p><p>Agile requirements: discovering <strong>what your users really want.</strong></p><p>This book will help you:<br>Save time and eliminate rework, <strong>make great user stories</strong>, and how to organize them, prioritize them, and use them for planning, management, and testing.</p><p>If you would like to learn about user stories, you can find the article written by my colleague <a href="https://medium.com/u/c6526b860a22">Atakan Ülgen</a> here:<br><a href="https://medium.com/modanisa-engineering/a-solution-of-communication-problem-between-business-and-technic-user-stories-1eb821c0b961">https://medium.com/modanisa-engineering/a-solution-of-communication-problem-between-business-and-technic-user-stories-1eb821c0b961</a></p><p><strong>10- Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*vbRmmVeMqLwQtbylkGYT4g.jpeg" /><figcaption>Continuous Delivery</figcaption></figure><p>When you start reading this book, <em>“Why haven’t I read it before?”</em> you will say.</p><p>Continuous Delivery is the ability to get changes of all types — including new features, configuration changes, bug fixes and experiments — into production, or into the hands of users, <em>safely</em> and <em>quickly</em> in a <em>sustainable</em> way.</p><p>The practices at the heart of continuous delivery help us achieve several important benefits:</p><ul><li><strong>Low risk </strong>releases</li><li><strong>Faster </strong>time to market</li><li><strong>Higher </strong>quality</li><li><strong>Lower </strong>costs</li><li><strong>Better </strong>products</li><li><strong>Happier </strong>teams</li></ul><p><strong>11- Extreme Programming Explained</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*oPuOIpFDy6GR24lWRwv6cw.jpeg" /><figcaption>Extreme Programming Explained</figcaption></figure><p>Extreme Programming (XP) was conceived and developed to address the specific needs of software development conducted by small teams in the face of vague and changing requirements.</p><p>This methodology challenges many conventional tenets, including the long-held assumption that the cost of changing a piece of software necessarily rises dramatically over the course of time. XP recognizes that projects have to work to achieve this reduction in cost and exploit the savings once they have been earned.</p><p>I hope you liked it. If you want to ask a question, please get in touch!</p><p><strong>References:</strong></p><p><a href="https://www.amazon.com/">https://www.amazon.com/</a><br><a href="https://www.goodreads.com/">https://www.goodreads.com/</a><br><a href="http://theleanstartup.com/">http://theleanstartup.com/</a><br><a href="https://continuousdelivery.com/">https://continuousdelivery.com/</a><br><a href="https://www.oreilly.com/">https://www.oreilly.com/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=662bc75e159c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/modanisa-engineering/must-read-books-for-product-management-662bc75e159c">Must Read Books for Product Management</a> was originally published in <a href="https://medium.com/modanisa-engineering">Modanisa Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>