<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nakul Garg on Medium]]></title>
        <description><![CDATA[Stories by Nakul Garg on Medium]]></description>
        <link>https://medium.com/@nakul.garg?source=rss-4e46642dc1c6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*sYKRhR4FM0X-PSVxO4oUhw.jpeg</url>
            <title>Stories by Nakul Garg on Medium</title>
            <link>https://medium.com/@nakul.garg?source=rss-4e46642dc1c6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 22:30:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nakul.garg/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What I learned from 2 years of (kind of) Nomad’ing]]></title>
            <link>https://medium.com/@nakul.garg/what-i-learned-from-2-years-of-kind-of-nomading-e35ad743d02c?source=rss-4e46642dc1c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/e35ad743d02c</guid>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[travel]]></category>
            <category><![CDATA[digital-nomads]]></category>
            <category><![CDATA[nomad]]></category>
            <dc:creator><![CDATA[Nakul Garg]]></dc:creator>
            <pubDate>Thu, 25 May 2023 15:58:13 GMT</pubDate>
            <atom:updated>2023-05-25T15:58:13.499Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vog8XutBPG1iNRMOKi0Q9w.jpeg" /></figure><p>Over two years ago, I decided to capitalize on my company’s lack of office. I abandoned the construct of 12 month leases in favor of more flexible short/medium term (2–3 month) Airbnb’s and Short Term Rentals. It felt like the right opportunity to test a newly possible lifestyle due to remote work as well as live out the fantasy lives I constructed in my head for years in a few major metropolitan cities. And just like that, coming out of the pandemic, I abandoned my parent’s house in Scarsdale for Manhattan… and Los Angeles… and Brooklyn (<em>yes this is significantly different than Manhattan</em>)… and London twice. My multi-month duration in each city is why I only consider myself a semi-nomad rather than complete nomad.</p><p>I write this article only partly to cosplay the iconic Carrie Bradshaw, but mostly as a reminder to my future self of what I picked up as well as what I put down<em> </em>during this experience. If you’re considering the same increase in your geolocation entropy then I hope this offers some anecdotal reference. If you’re reading this because you’re bored, that’s okay too.</p><p><strong>The first few days/weeks anywhere truly new will probably be rough. </strong>Unless you’re going somewhere you already know and have a ton of friends, the early stint of the journey can be challenging. This doesn’t mean the experience is not worthwhile, but it means that it isn’t always easy. When I first went to Los Angeles, I had more fingers than friends. I was blessed because those friends were deep connections, but I still found early on that if this subset of people were busy, then I was alone. This recurring sentiment was probably the hardest part of my journey. It’s the funny thing about breaking the status quo, there are less people that are doing/thinking the same. Amidst the waves of stimulation and excitement in the first leg of a new city, I found an undercurrent of self-doubt. Things along the lines of: “What am I doing here?”, “Did I seriously leave all my friends to go to a place where I know so few people?”, and “What the heck do I do?”. As I gained more experience moving, I found that recognizing those feelings as natural, but temporary, gave me solace. I tried my best to lean into the strengths / notable characteristics of the new city rather than sink into the absence of the last one. For example, if you’re in LA, hike the trail to the Hollywood sign early on. Do that touristy s**t to let your brain BELIEVE you’re in that city and that your upcoming local friends may not want to do with you. I never got to 0 nomad panics in a first new city week, but I did get closer and closer.</p><p><strong>Don’t stress about forgetting THINGS you “need”, but do optimize for PROCESSES you need. </strong>Unless you are a new born with an impressive amount of disposable income and autonomy, you’ve logged some hard years into figuring out who you are. Moving cities every few months will make you question that, and that’s part of the beauty of it. But I found having a few anchors of my identity from what I had learned prior to nomad’ing seriously helped me. I’m a dancer so a huge joy for me was taking dance class in the cities I temporarily lived in, and I actually made most of my new friends through this. I learned not to stress about packing all my dance sneakers, but to make sure I found studios near where I was staying. In fact, I did almost all of this journey in a pair of (<em>formerly</em>) white high top Nike Air Force 1s and black Adidas Ultraboosts, which if you know me or my closet, is some serious personal growth. I also like to work out, so making sure I had access to a gym turned out to be more important than making sure I had packed protein powder and a Theragun. Other examples for me include making playlists for <a href="https://open.spotify.com/playlist/3NvJhE9B4IEuf34gQeRvAG?si=8f15e2cd7a60446f">real</a> or <a href="https://open.spotify.com/playlist/7zHw6XGSru8qCOXtPm0x2F?si=5335a612d42a4f8e">theoretical</a> situations, watching every Manchester United game, and <a href="https://open.spotify.com/playlist/18oLss6ltIKEgXCszj9dSR?si=93221396efa34143">hosting pregames</a>/<a href="https://open.spotify.com/playlist/6UvIIxBzfYbWzXxmq6zSeg?si=fc03bfa24d9243af">dinner parties</a>. Anywhere I went I could buy the things that I forgot, but I could not buy the understanding of what activities I need to keep me… me.</p><p><strong>Working outside of my company’s timezone took some finesse. </strong>Unless you work for a company with a truly remote-first, global culture, which is different than just being a newly remote company, you may find yourself in situations where you are at the pub while the rest of your company is working. This will feel weird and can induce a lot of corporate guilt. But I am thankful as a software engineer at a growing startup that my performance is assessed by what I build rather than when and how long I am building. I also luckily operate on <a href="http://www.paulgraham.com/makersschedule.html">maker time rather than manager time</a>, so I thrive on long periods of times without meetings and small periods of time with high meeting density. This calendar is really what allowed me to keep my productivity high, thus staving away the corporate guilt with consistent and iterative product releases and 60–80% of my ambitious OKRs being met (<em>this half-joke is for my fellow tech nerds</em>). In London, I could develop from 11AM — 4PM GMT (6AM — 11AM EST) and meet from 4PM — 7PM GMT (11AM — 2PM EST). There were limited but non-zero occasions where I took a call from the club.</p><p>OK for my fellow developers here’s the setup I rocked:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qr8QrcMOj9Os7bS8iK1HGQ.jpeg" /></figure><p>So yes, you can have a setup that your fellow developers will respect, AND pack it all into one backpack. This entire setup only needs one outlet and that’s to keep your laptop charged since running Docker takes so much damn battery. Here are the links:</p><ul><li><a href="https://www.amazon.com/gp/product/B06Y8SSQG5/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1">Monitor</a></li><li><a href="https://www.amazon.com/Freestyle2-Ergonomic-Keyboard-Standard-Separation/dp/B00CMALD3E/ref=sr_1_2?crid=35KGHI9LVBRVJ&amp;keywords=Kinesis&amp;qid=1664241816&amp;qu=eyJxc2MiOiI0LjAwIiwicXNhIjoiNC4yMiIsInFzcCI6IjQuMjMifQ%3D%3D&amp;s=electronics&amp;sprefix=kinesis%2Celectronics%2C78&amp;sr=1-2&amp;ufe=app_do%3Aamzn1.fos.18ed3cb5-28d5-4975-8bc7-93deae8f9840">Keyboard</a></li><li><a href="https://www.amazon.com/dp/B09DPLZ741?psc=1&amp;ref=ppx_yo2ov_dt_b_product_details">Mouse</a> (yes you can flame me for using the non-ergonomic Apple mouse but I love the two finger swipe to change desktops)</li></ul><p><strong>People drive experience more than the actual place. </strong>As amazing as any city can be, without the right set of people, it won’t be fun. I don’t say this to discourage you from going to places where you know no one, but to encourage you to be intentional about meeting new people there. The person you take a walk with will influence your experience more than where you are walking. However, the views and local interactions of that walk can bring you a flavor unique to that city. Also, when you meet locals, you will see the city through their lens. You will experience that individual’s neighborhoods, restaurants, bars, parks, flower markets, and more. Simply put, Henry knows a different London than Isabel. Each helped me see the city in a way I wouldn’t find by myself and I am eternally grateful. They helped me create Nakul’s London. My friends in each city fully framed my experience there.</p><p><strong>Time is limited. </strong>One of the most profound things I found was that the inherently temporary nature of my time in a city provided so much great motivation to enjoy the experience. I got out of my Airbnb so much more than I would get out of my home. Which is funny because in an existential way, all of our time is limited anywhere. I aim to bring the same energy I had to explore a city daily to (spoiler alert) New York where I have since settled.</p><p><strong>There are so many lives I could live. </strong>I’d love to say my current New York life was the only possible outcome. But I learned from this experience that in the multiverse there is a LA Nakul, London Nakul, and New York Nakul. I like to believe my personality was fairly consistent, backed by the fact that my London friends and New York friends bought me the same <a href="https://www.amazon.com/Divine-Feminine-Explicit-2LP/dp/B01LWJCOM9">birthday gift</a>, but the lifestyles in each place are wildly different. Since I didn’t want to nomad forever, I then had the incredibly confusing choice of picking which life I wanted. This was one of the hardest parts of the entire process and I don’t really have any advice on how to do this. Good luck if you get to this point.</p><p><strong>Don’t leave without saying goodbye. </strong>While both you and your new/existing friends in a particular city will timidly accept a well written text, going out with an IRL bang actually helped me close each chapter and show those people how much I loved them. I never wanted the end of one city’s chapter to have a period in my book, only exclamation points! In LA, the now problematic Free Hoover concert where Drake and Kanye reunited / performed gave me the cinematic end to my time there with some good friends. In London, a rambunctious pub night followed by a deeply emotional postgame gave us what we needed. I even started writing mini-speeches to deliver at these goodbyes because it allowed me to directly express what those people and that place meant to me. This direct communication gave me the peace of mind that I did my best to show the people that dictated my experience what they meant to me. It also selfishly allowed me to start the process of moving on with a clear conscience. Just remember… squeeze as hard as you can for those last hugs because the next one may not be for a while.</p><p><strong>In the end, while nomad’ing, you end up leaving all your problems behind… but you also end up leaving everything you love. </strong>After two years of quarterly moves, I decided to call it a quits. I felt the need to build relationships and satisfaction that are deeper than 3 months allows. I wanted to know the person working at my local shop. I wanted to join a dance team where I could commit every Saturday until oblivion to them. I wanted to make plans for a holiday with my friends that’s not for another half year. I wanted an apartment that is a reflection of who I am rather than my Airbnb host. I wanted the stability to work on my diet/health rather than planning another move. None of that is to say I regret my time nomad’ing because I don’t. I loved it. I would always do it again for that period of my life. I was just ready to move on and take these things I learned about myself and others into the next chapter of my life. I was ready to be a permanent fixture in a city and for the people that inhabit it rather than a transient traveler.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e35ad743d02c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Intercom Accessibility — RTT / TTY]]></title>
            <link>https://medium.com/latch-engineering-blog/intercom-accessibility-rtt-tty-6d094321fd01?source=rss-4e46642dc1c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/6d094321fd01</guid>
            <category><![CDATA[hard-of-hearing]]></category>
            <category><![CDATA[accessibility]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[intercom]]></category>
            <category><![CDATA[latch]]></category>
            <dc:creator><![CDATA[Nakul Garg]]></dc:creator>
            <pubDate>Mon, 14 Dec 2020 17:17:26 GMT</pubDate>
            <atom:updated>2020-12-14T17:26:28.915Z</atom:updated>
            <content:encoded><![CDATA[<h3>Intercom Accessibility — RTT / TTY</h3><figure><img alt="Latch Intercom shows Accessibility mode screen saying, “Call 1–555–555–5555 to connect your phone to the Intercom”" src="https://cdn-images-1.medium.com/max/1024/1*Bhbtkeq72cUdKMyKj3zjPQ.jpeg" /><figcaption>Latch Intercom Accessibility Mode</figcaption></figure><p>At Latch, we strive to engineer products that utilize modern technology to create functional experiences for all people, regardless of physical ability. And so, we are proud to discuss specifically our hard of hearing/speech impaired Accessibility flow for Latch Intercom which incorporates RTT / TTY calling through Users’ smartphones. First, we will describe what already existed in this space and then we will overview what Latch Intercom provides. Finally, we will provide technical details on how to implement such a flow. We hope that where relevant, companies will continue to adopt smartphone RTT / TTY capabilities to provide productive, modern experiences for all.</p><h3>The Existing</h3><p>The TeleTYpewriter (TTY) was introduced in the 1960s as a way for those that are hard of hearing or speech impaired to communicate via live text messages.<a href="https://www.youtube.com/watch?v=qPnRhli0g8Y"> Users at either end plug a TTY machine into the line and their text is converted to and from morse code style tones</a>. This technology went on for far too long without innovation until 2017 when<a href="https://support.apple.com/guide/iphone/rtt-and-tty-iph3e2e47fe/ios"> iOS</a> and<a href="https://support.google.com/accessibility/android/answer/9042284?hl=en"> Android</a> both introduced this functionality to their smartphone operating systems. The smartphone version of this technology is often referred to as Real-Time Texting (RTT). However, nowadays the terms RTT and TTY are regularly used interchangeably as the underlying technology of morse code style tones has remained the same.</p><figure><img alt="Picture of a TeleTYpewriter machine. The machine looks like a landline phone with a keyboard." src="https://cdn-images-1.medium.com/max/406/1*NLiden1-nJ0WIKH13JZn4A.jpeg" /><figcaption>Physical TTY Machine</figcaption></figure><p>The current standard for intercoms is that they provide a headphone jack which allows Guests &amp; Residents to use the machines founded in the 60s to converse. Unfortunately, these machines are not only old but <a href="https://www.amazon.com/Ultratec-Minicom-IV-Telephone-TDD/dp/B002VRTIYO/ref=sr_1_2?dchild=1&amp;keywords=ultratec+minicom&amp;qid=1605485891&amp;sr=8-2">large and expensive</a>. With the incorporation of RTT to smartphones, it is completely unnecessary to expect an entire set of people to constantly lug these machines around.</p><h3>The New</h3><figure><img alt="iPhone screenshots of the iOS RTT/TTY calling flow. The iPhone shows a keyboard within the calling screen." src="https://cdn-images-1.medium.com/max/1024/1*soZbno54MaycnlZO3G7cQw.png" /><figcaption>iOS RTT Interface</figcaption></figure><p>With the Latch Intercom, we recognized that there is an opportunity to go beyond simple compliance in order to create a truly useful experience for those that are hard of hearing or speech impaired. It is important to note that there are two major actors in an intercom exchange: the Guest using the intercom and the Resident being contacted by the Guest. The Guest is trying to call a specific Resident in order to verify his/her/their identity and the Resident decides whether or not to permit entry.</p><p>Here is what we did with the Latch Intercom:</p><ul><li>Guests that desire to use our Accessibility mode can press and hold the left button for 5 seconds. This is signaled to the Guest both via text and a braille plate.</li><li>Once Accessibility mode is triggered, we display a number to which the Guest at the Intercom can choose to call. It is important to note that the displayed number is NOT the Resident’s phone number but rather a Latch owned phone number that will host a group call.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sI3-QB1v2NWfk97wkhS3aA.jpeg" /></figure><ul><li>If the Guest is hard of sight but otherwise able, then they may proceed without calling the number and our Text-to-Speech interface will carry on reading instructions aloud. If the Guest is hard of hearing or speech impaired then they may call this number and be placed into a call with the Latch Intercom.</li><li>From here the Guest will receive a text message in their RTT interface instructing them to select a Resident (pictured to the left).</li><li>Once selected, the Resident will be called, and upon answering be placed into a group call with the Guest. We play a short, spoken message to the Resident informing them that the caller is expecting them to use their phone’s RTT interface.</li><li>When the Resident is connected, we stream an RTT/TTY message to the group call stating that all parties are connected.</li><li>Now the Guest and Resident can successfully converse via RTT. Neither party requires a TTY machine. If the Resident trusts the Guest then they can press 9 to trigger the unlock.</li></ul><h3>The Technical</h3><p><em>For the purposes of this article, we will stay at a high-level so that this framework can help those using any calling partner/implementation. For the web-hooks, response bodies won’t be specified as that would be implementation-specific, but the flow charts will provide definitive logical steps.</em></p><h4>Dynamic Number Allocation</h4><p>The number shown by the Latch Intercom has to be known by our Backend in order to route the Guest and Resident into the correct conversation. Naturally, a one number per intercom model AKA static allocation comes to mind first. However, given the less frequent nature of Accessibility calls, this would be cost-ineffective. Thus we’ve developed a dynamic number allocation system. Intercoms request a number from the Backend when they need it and free the number when it is no longer in use. With dynamic allocation, we are able to scale up or down the number pool in order to meet the demand seen in the field. Here is the logic around the endpoint which allocates this number:</p><p><strong><em>GET /accessibility</em></strong></p><p>Flow Chart:</p><figure><img alt="Flow chart diagram showing decision tree for how to allocate an Accessibility number to an intercom" src="https://cdn-images-1.medium.com/max/1024/1*FowfexyTPJhpZwPhzZZEWg.jpeg" /><figcaption>Latch Accessibility Number Allocation</figcaption></figure><p>Expiring stale allocations could be designed to happen outside of this endpoint, but we prefer to do that here in order to maximize the chances of having a free number available. At the current scale, this is possible without being overly time-consuming. Another potential improvement is instead of returning a 4XX error when there aren’t any numbers available, we could actually buy a number here. Otherwise, the logic is straightforward.</p><p>We also expose an endpoint where intercoms can explicitly free numbers themselves. The intercom hits this endpoint if Accessibility mode expires or is canceled without a call. The logic here is just the freeing of any number that is allocated to the intercom thus no flow chart is necessary. On top of this, for any call termination events, we check if the Intercom has an Accessibility number allocated. If it does, we end that allocation thus freeing the number. That sums up how our dynamic number allocation works, but we still need to discuss how all the actors are placed into a group call.</p><h4>Web-Hooks</h4><p>At Latch, we use a <a href="https://developer.nexmo.com/concepts/guides/webhooks">web-hook model</a> with our calling partner in order to dictate the flow of all calls. This model seems standard across many communication APIs. We leverage this framework to place the Guest, Latch Intercom, and Resident all in the same call. We have two web-hooks with our calling partner: the answer-hook and the events-hook. The answer-hook provides our partner with all the control information necessary at the time the Latch Intercom places a call or a Latch-owned virtual number is called. The events-hook is where our partner sends informative events about the status of the call. This second hook is necessary to determine when we stream RTT messages into the conversation in order to guide our Guest and Resident. Let’s get into the general logic for each:</p><p><strong><em>Answer Hook — POST /answer</em></strong></p><p>Request Body:</p><ul><li>Source: Who is calling?</li><li>Target: Who is being called?</li></ul><p>Flow Chart:</p><figure><img alt="Flow chart diagram showing decision tree for the answer hook" src="https://cdn-images-1.medium.com/max/1024/1*EvWM00CA8XmtyfZ-Ak2HTA.jpeg" /><figcaption>Latch Answer Hook</figcaption></figure><p>In yellow is the path which directs the Guest into the call. In red is the path which directs the Intercom into the call and invites the Resident. In blue is the non-accessibility path.</p><p><strong><em>Events Hook — POST /event</em></strong></p><p>Request Body:</p><ul><li>Source: Who is the caller for the leg of the call to which this event relates?</li><li>Target: Who is the callee for the leg of the call to which this event relates?</li><li>Status: What is the status of the call leg?</li></ul><p>Flow Chart for events with Connected Status:</p><figure><img alt="Flow chart diagram showing decision tree for the events hook" src="https://cdn-images-1.medium.com/max/1024/1*zj5dzcHcAoauee-EEcNvig.jpeg" /><figcaption>Latch Events Hook</figcaption></figure><p>With the general logic outlined above, any company should be able to set up group RTT / TTY calling from an IP-based intercom. Any calling service or implementation should provide the methods needed to execute the call control needed. Some in-house work will be needed around owning/allocating Accessibility numbers and tracking Accessibility calls, but hopefully, this article makes that process clearer. This feature is currently live at every Latch Intercom but we hope to see versions of it at every intercom in the world. This is a great opportunity to serve our hard of hearing and speech impaired communities! As always, we are open to feedback and potential improvements. Please do not be afraid to comment or reach out.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d094321fd01" width="1" height="1" alt=""><hr><p><a href="https://medium.com/latch-engineering-blog/intercom-accessibility-rtt-tty-6d094321fd01">Intercom Accessibility — RTT / TTY</a> was originally published in <a href="https://medium.com/latch-engineering-blog">Latch Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-End Testing in the Development Environment]]></title>
            <link>https://medium.com/latch-engineering-blog/end-to-end-testing-in-the-development-environment-7ad358eb9534?source=rss-4e46642dc1c6------2</link>
            <guid isPermaLink="false">https://medium.com/p/7ad358eb9534</guid>
            <category><![CDATA[bdd]]></category>
            <category><![CDATA[integration-testing]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[latch]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Nakul Garg]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 22:56:41 GMT</pubDate>
            <atom:updated>2020-02-03T23:11:39.767Z</atom:updated>
            <content:encoded><![CDATA[<h4>Author: <a href="https://www.linkedin.com/in/nakul-garg/">Nakul Garg</a></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ef9WUAhlzKp0_zV2s2ps4A.jpeg" /><figcaption>Presentation of the Latch C</figcaption></figure><h3>Motive</h3><p>The development environment of a software system is typically the Wild West for a technology-oriented company. But at Latch, we think it’s necessary to formally test this chaos. We believe there’s valuable insight gathered during this process—helping engineers discover bugs earlier on and reducing the chances of one ever reaching production. By running a test suite after every merge, developers can know within minutes whether their recently pushed code has issues. More specifically, routine integration tests can catch system regressions by simulating the real world environment. Here, we outline our testing framework, which can apply to any development environment, with the intention of being lightweight and routinely-run.</p><h3>Technical Overview</h3><p>Due to limited resources, we prioritized ease and speed of development in our test environment. These values naturally led us to develop in Python, using behavior-driven development (or BDD) called <a href="https://behave.readthedocs.io/en/latest/">Behave</a>. This technique allows tests to be defined in plain English in feature files and is automatically mapped to Python—allowing people of various technical backgrounds to methodically define their tests that engineers can then easily digest and translate into code. We’ll go further into detail about Behave later in this article, and we also provide our recommended directory structure as a great starting point.</p><p>We also prefer Behave because it seamlessly integrates with <a href="https://docs.qameta.io/allure/">Allure test reporting</a>, which then conveniently integrates with <a href="https://jenkins.io/">Jenkins</a>, a popular open source automation server. This whole process takes only minutes to set up and run, resulting in an Allure report link that can be shared via Slack, email, and other channels. These three frameworks quickly work together to provide routine reports about the state of features in development.</p><h3>Behave</h3><p>To get started, we’ll provide basic instruction to quickly put together a test suite. To learn more about the Behave framework, please see the actual <a href="http://behave.readthedocs.io/en/latest/">documentation</a>.</p><h4>The Environment File (environment.py)</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ee07fcd7245c1fa4bf7423c4157c4a55/href">https://medium.com/media/ee07fcd7245c1fa4bf7423c4157c4a55/href</a></iframe><p>The environment file where developers using Behave can define a function that runs before every test. This is useful to populate Behave’s “context” concept. The “context” is a variable in which steps can add data in order to pass information. The “before_all” function is a great place to define global variables about your system that will be useful to have available across tests.</p><h4>Feature Files</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/570f75d8034e7f1510fa49c607059dc1/href">https://medium.com/media/570f75d8034e7f1510fa49c607059dc1/href</a></iframe><p>Feature files are a plain English definition of the test, but they can be set up so that they organize when and which code is run. Feature files are defined with a short description.</p><p>Next, it’s important to declare a “scenario” or test procedure. We define a scenario outline with a test name. Features can have any number of scenarios, and each scenario can be deployed when the feature is run. The following lines starting with “Given,” “When,” or “Then” represent steps in the test. “Given” steps set up base information,“When” steps utilize information in some way, and “Then” steps assess the expected state.</p><p>These are the components that map directly to a Python step implementation. As a result, we can conveniently reuse these steps by using the same language since Behave will automatically match it back to implementation steps. There’s no limit to the number of steps in a scenario.</p><p>Information can be passed to a step through a &lt;parameter&gt;. The first row of the Examples section defines the parameters, and each of the following rows defines sample values. For example, the first run of the scenario above tests that user1@place.com with user1password gets thing1 and thing2 when logging in. The second run tests that user2@place.com with user2password has no things when logging in. If the expected information is large, then parameters can represent a file path which can be opened from the Python implementation. Lastly, we can tag scenarios and run a test set based off of their tags.</p><h4>Python Step Files</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/000f834e8855c1e14d3ae38c7b824423/href">https://medium.com/media/000f834e8855c1e14d3ae38c7b824423/href</a></iframe><p>Python step files are where the actual implementation lives.<em> </em>Through Behave’s function tags, the steps that we defined in our Scenarios can be linked easily to Python implementations. The actual function name does not matter because all linking will come from tag. The “@given” tag is used above, but the format is the same for @when and @then. Parameters from the feature step must have {} around them rather than the &lt;&gt; in the Feature.</p><p>Next, it’s necessary to define the parameters as actual function inputs with matching names, and the information is readily available. Then, all we have to do is actually implement the step. For example, the step shown above hits an endpoint to log in and stores the response in the context for the next step to deal with.</p><h4>The Package File (package.json)</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/575dfe0a13411c0474176a9647d2434b/href">https://medium.com/media/575dfe0a13411c0474176a9647d2434b/href</a></iframe><p>In order to make running tests from the command line more convenient, we threw together a quick package.json file. From the example above, we can put “npm run dev” into the command line which will run every test with the dev tag. The <a href="https://pypi.org/project/allure-behave/">Allure Formatter</a> is discussed later in this article.</p><h4>Recommended Directory Structure</h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/022fe81e67aeb448c81afac9b9d26c1e/href">https://medium.com/media/022fe81e67aeb448c81afac9b9d26c1e/href</a></iframe><p>Behave mandates a rigid directory setup with some peculiar rules — the most unexpected being that a “steps” directory must contain all Python step files without any nested directories. This rule can be an eyesore for any system-wide test suite, so we start the name of any Python step file with a prefix indicating what context of the system the step applies. Since feature files are allowed to be in nested directories, we create a directory for each context. Note that some steps can be reused contexts in which case a prefix indicating a shared context can be used.</p><h3>Allure Report</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*oGoXHD9WerEdjVKVZJ-VdQ.png" /></figure><p>Allure is a test reporting framework which can be added to the Behave command line run and configured in the Jenkins job—conveniently creating a dashboard like above. All you have to do is run something like this (npm run dev is set in our package file from above):</p><blockquote>$ pip install allure-behave</blockquote><blockquote>$ npm run dev</blockquote><h3>Jenkins Job</h3><blockquote>$ cd behave-integration-tests</blockquote><blockquote>$ pwd</blockquote><blockquote>$ rm -R allure-results</blockquote><blockquote>$ rm -rf reports/*.xml</blockquote><blockquote>$ python3 -m venv env</blockquote><blockquote>$ source venv/bin/activate</blockquote><blockquote>$ pip install allure-behave</blockquote><blockquote>$ pip install -r requirements.txt</blockquote><blockquote>$ npm run dev</blockquote><p>The last step of the process is to set up an automated job that can kick off the Behave test suite at an interval of your choice. For this, we recommend Jenkins because of the existing integration with Allure and Slack. We have configured our job so that it pulls our development branch, runs the test suite, and then Slack messages a dedicated channel with a link to the Allure dashboard daily. In order to run daily, we have a Build Trigger with the schedule “H 10 * * *”. The commands above are the actual set of Build commands for our Jenkins job. Finally, we configure Jenkin’s Allure Report Post Build action with a path to our generated Allure results folder and set a Slack Notification. After those are set up, then you are ready to reap the rewards of continuing insight into your system.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7ad358eb9534" width="1" height="1" alt=""><hr><p><a href="https://medium.com/latch-engineering-blog/end-to-end-testing-in-the-development-environment-7ad358eb9534">End-to-End Testing in the Development Environment</a> was originally published in <a href="https://medium.com/latch-engineering-blog">Latch Engineering Blog</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>