<?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 Jan Hoogeveen on Medium]]></title>
        <description><![CDATA[Stories by Jan Hoogeveen on Medium]]></description>
        <link>https://medium.com/@janhoogeveen?source=rss-4fbb279382ce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*vurqdKPiSRTgS_vKWj4Ubg.jpeg</url>
            <title>Stories by Jan Hoogeveen on Medium</title>
            <link>https://medium.com/@janhoogeveen?source=rss-4fbb279382ce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 10:33:27 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@janhoogeveen/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[Refactoring web applications]]></title>
            <link>https://medium.com/@janhoogeveen/refactoring-web-applications-9ed0454ba1b7?source=rss-4fbb279382ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ed0454ba1b7</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[refactoring]]></category>
            <dc:creator><![CDATA[Jan Hoogeveen]]></dc:creator>
            <pubDate>Sun, 17 Mar 2019 00:00:00 GMT</pubDate>
            <atom:updated>2019-12-14T12:48:42.892Z</atom:updated>
            <content:encoded><![CDATA[<h4>In which we explain technical debt and a way forward</h4><figure><img alt="“Debt will tear us apart” graffitied on a public wall" src="https://cdn-images-1.medium.com/max/1024/0*Wju8vJqD4o3_rNMI" /><figcaption>Photo by <a href="https://unsplash.com/@rruthology?utm_source=medium&amp;utm_medium=referral">Ruth Enyedi</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Does this sound familiar?</p><p>You’ve started this great new project and have been hammering out new features at a great pace. Lately your velocity has dropped. It was only a minor decrease in the beginning, but it’s becoming a severe slowdown now. Now you’re at a point where you feel that you’re having to defend yourself to stakeholders on why it’s taking so long to deliver new features.</p><p>You’re probably dealing with something that’s called tech debt. Tech debt is the accumulation of technological decisions that favor short-term velocity over long-term maintenance. It’s the result of making choices that made you look good at the start of the project by cutting corners, but it’s slowly becoming a more serious problem now that your project has matured.</p><p>Just like financial debt in the real world, it’s better to pay off your debt before it accumulates in even more debt.</p><p>When working in software development, paying off your (tech) debt is called <em>refactoring</em>. During refactoring, you take existing code and change it in such a way that results in more maintainable, readable code. One important condition is that the external behavior of the code stays the same. In the case of this example, that means our features still perform the same pieces of functionality as before.</p><p>Note: Some people might tell you that “ <em>refactoring is only for people who write bad code in the first place</em>”. Please, ignore those people! It’s simply not true. There’s plenty of reasons why tech debt is introduced in a project, and I’d argue the most important one is agile development.</p><p>While working agile, you’re dealing with constantly evolving requirements. You’re building working software, releasing it to the world and based on feedback from going to production you’ll re-iterate again. This, by definition, makes it impossible to design a scaleable, maintainable solution from the start.</p><p>An encompassing overview, which you’d need to make all the right choices from the start, of the product will only be possibly by the time that a substantial amount of time and energy has already been invested in the project already. Only by the time that the product contains a decent amount of consumer facing features will you be able to fully understand the results of your initial choices.</p><h3>Approaching the refactor</h3><p>Refactoring can sound like a daunting task. It can involve changing critical parts of your application in an all-or-nothing approach. That’s why you have to treat it just like any other enormous issue in an agile project. Consider “refactoring” as an epic and break it up in tons of smaller stories. The goal is for every story to reduce tech debt, piece by piece.</p><p>Accept refactoring as a recurring part of your sprint cycle.</p><h3>Steps to refactoring</h3><ol><li>Create a list of annoyances/items that you want to solve. Involve the whole development team in these discussions. Do not let designers or product owners join these discussions. The idea is that developers can figure out on their own which parts of the codebase are blocking their progress the most. Let them own both the problem of tech debt, but more importantly the solution to these problems. Nothing is more empowering than knowing you can solve problems on your own.</li><li>When doing sprint refinement, go over the refactoring list and discuss in broad strokes how you want to solve this issue.</li><li>Deprecate methods or options. Use JSDoc to document which methods/classes you’re deprecating and why. This helps with tools like IntelliSense. Also write down which alternative methods should be used instead, so developers will know what to do when confronted with the deprecation warning.</li><li>Ensure you have a solid set of tests written for your deprecated methods, so you know when refactoring everything still works.</li><li>Write a replacement method and apply it to at least one place of your codebase. When everything works as expected, refine the API. Take a step back. What annoyed you about the previous solution, and did you solve what you set out to do? If you’re happy with the new API, write and/or port tests.</li><li>Replace all other instances of the deprecated message too. Update tests/mocks where needed.</li><li>Rinse and repeat.</li></ol><p>Another way to get the message across is to use console.log to provide information to developers while they are in development mode. Take care not to ship this to production, as it can look unprofessional. For our React projects we’ve created a small utility hook called useDeprecationMessage that checks if you’re running in development mode,</p><p><em>Originally published at </em><a href="https://janhoogeveen.eu/blog/refactoring-101"><em>https://janhoogeveen.eu</em></a><em> on March 17, 2019.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ed0454ba1b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to whitelist your Next.js serverless deployments on Now]]></title>
            <link>https://medium.com/@janhoogeveen/how-to-whitelist-your-next-js-serverless-deployments-on-now-ed91858ed6ae?source=rss-4fbb279382ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/ed91858ed6ae</guid>
            <category><![CDATA[react]]></category>
            <category><![CDATA[now]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[serverless]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Jan Hoogeveen]]></dc:creator>
            <pubDate>Sat, 23 Feb 2019 11:13:12 GMT</pubDate>
            <atom:updated>2019-02-23T11:13:12.847Z</atom:updated>
            <content:encoded><![CDATA[<h4>How to use Now to easily deploy your Next.js projects without allowing the whole world to access it</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KlUSADZEP9yZtOo6" /><figcaption>Photo by <a href="https://unsplash.com/@mr_williams_photography?utm_source=medium&amp;utm_medium=referral">Micah Williams</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>I like Next.js. It allows me to build rich data-driven web applications in React that are generated server-side. What I don’t like is setting up servers and installing process managers to run node applications for my development and staging servers. To solve this, the clever people at Zeit have developed Now, a serverless platform where you can deploy your web applications with ease.</p><p>Rougly two weeks ago Zeit has released <a href="https://nextjs.org/blog/next-8/">Next 8</a>. With it comes support for serverless deployments using lambdas. A new feature I’d love to use more, where it not for one small problem. I want to shield my web applications from the public world while I’m still working on it. A very common workflow is to use protected development and staging servers before pushing changes to production servers. Unfortunately, that’s something the Next/Now.sh combination is not facilitating at this moment.</p><p>The way Now handles security, is by prefixing your project name with a random unique identifier. For instance, if your project is named <em>my-hidden-project</em>, you can access your deployment on a url like <a href="http://my-hidden-project-/**kdoe2jfh2**.now.sh">http://my-hidden-project-<strong>kdoe2jfh2</strong>.now.sh</a></p><blockquote><em>“The UID is derived from a large cryptographically random number encoded as 9 alphanumeric characters. However, if you want additional privacy, you can also replace the .now.sh suffix with any custom domain of your choice, making the URL 100% unguessable, so that not even the very existence of the deployment can be verified by third parties.”</em></blockquote><p>This sounds like <a href="https://en.wikipedia.org/wiki/Security_through_obscurity">security through obscurity</a> to me. That’s simply not good enough. I want to be 100% certain that I can deploy a web application and that it’s only viewable by me or my team members, even if it has a predictable URL.</p><p>I’ve googled around but I could not find a solution to this problem. So, here’s my hacky solution to this serious problem which I hope gets solved in a native way soon.</p><p>When running a Next.js project with a serverless target in the Next.js Builder (@now/next), it passes the request and response objects, or <a href="https://nextjs.org/docs/#serverless-deployment">IncomingMessage and ServerResponse</a> as the docs call them to your lambdas. It also passes these arguments to the getInitialProps method, which is always executed on the server before the server returns any DOM representation at all.</p><p>Here’s a <strong>barebone example</strong> of disallowing everyone to visit your page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*45WBewPy9KPpUhrD9nGd_Q.png" /></figure><p>Go ahead and try that out. It’s not very useful yet, but it proves you can exit a render early and return a 403 response to the browser. From here, it’s a matter of expanding on the example to your liking.</p><p>Here’s an <strong>enhanced version</strong> that <em>disallows everyone by default</em>, and <em>whitelists</em> a few IP addresses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GSGR6CnceatOITkXJpoO1w.png" /></figure><h3>Update</h3><p>Tim Neutkens expanded on the idea and <a href="https://twitter.com/timneutkens/status/1099066200460574720">suggested</a> I could use HTTP Basic Auth as well. That way, whenever a visitor is not in the allowed IPs whitelist, you could fallback to a username/password authentication box. Ideal for sharing your deployments with remote workers, clients and other stakeholders.</p><p>Because I’m lazy, I’m not going to write the logic for authorization myself, so I’ve added in a dependency on the <a href="https://github.com/jshttp/basic-auth">basic-auth</a> package.</p><p>In order to keep the logic re-useable and out of the way of my pages, I’ve abstracted away the authentication logic in a new helper file</p><p>Here’s a<strong> normal page file</strong> where we invoke the authentication abstraction</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UcH883KnElZa8m1qnC0zAA.png" /><figcaption>The cleaned Page file, calling the re-useable useAuthentication abstraction</figcaption></figure><p>And here’s the <strong>improved authentication </strong>logic itself, with basic-auth added as a fallback mechanism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EkpLzTgF3aF_cCbPp9GZQw.png" /><figcaption>/lib/useAuthentication.js checks for a IP whitelisting first, and failing that, provides a basic auth fallback to visitors</figcaption></figure><p>And there you go. If the user is whitelisted, they will never see a login screen. If their not whitelisted, they still have a chance to log in through a username and password combination.</p><p>Of course, this is a very basic example and I’m sure there’s some security issues here. Take care when implementing this in your lambda deployments!</p><h3>Alternative solutions</h3><ol><li>If you don’t want to use lambdas, it should be possible to use the <a href="https://nextjs.org/docs/#custom-server-and-routing">Next.js middleware</a> and wrap it in your own server. I haven’t tried it yet, but I imagine it would be easy to add basic authentication for disallowed IP addresses with this solution.</li><li>If you have control over your own custom domain, it should be possible to point it to Cloudflares DNS servers, and use their firewall to only allow access from specific IP addresses or even IP ranges. That way it should be possible to have a single source of truth of protection — <em>for all projects under that domain</em> — without having to call the getInitialProps method on every page. Of course you lose the benefits of letting Now manage your domain, but do you really need that for your development servers?</li></ol><p><em>Originally published at </em><a href="https://janhoogeveen.eu/blog/whitelisting-access-to-now-serverless-deployments"><em>janhoogeveen.eu</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ed91858ed6ae" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On Applying for a Job as a Developer]]></title>
            <link>https://medium.com/clever-franke/on-applying-for-a-job-d9d5817b294d?source=rss-4fbb279382ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9d5817b294d</guid>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[hiring]]></category>
            <category><![CDATA[applying-for-jobs]]></category>
            <dc:creator><![CDATA[Jan Hoogeveen]]></dc:creator>
            <pubDate>Tue, 22 Jan 2019 20:42:00 GMT</pubDate>
            <atom:updated>2019-01-23T19:09:46.010Z</atom:updated>
            <content:encoded><![CDATA[<h4>Some practical advice in showing your value and getting noticed by hiring managers.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oLbrzo4h8MR-ruNZ" /><figcaption>Photo by <a href="https://unsplash.com/@grohsfabian?utm_source=medium&amp;utm_medium=referral">Fabian Grohs</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p><strong><em>Note:</em></strong><em> This blogpost was originally posted at </em><a href="https://janhoogeveen.eu/blog/applying-for-a-job"><em>https://janhoogeveen.eu/blog/applying-for-a-job</em></a><em> and has been edited slightly for this Medium publication.</em></p><p>At my current job, I’ve been screening and interviewing candidates for front-end developer roles for a couple of years now. We’re lucky to have a healthy stream of applicants coming in, but not many people make it to a first interview. Let’s focus on one reason why, in my personal opinion, applicants don’t get invited for an interview.</p><p><em>A lot of candidates simply don’t sell themselves very well.</em></p><p>I think that’s a shame. Without a doubt, some technically strong candidates have not been invited for an interview because they did not sell their value clearly.</p><p>Disclaimer: I’ve only performed interviews for one company so far. It’s almost guaranteed that anything I say here is not interchangeable advice for other companies. I’m also not going to dive into well-known advice such as not sending over resumes with spelling mistakes in them.</p><h3>The Reality of Selecting Candidates.</h3><p>The first thing you need to know, is that hiring managers have very limited time to evaluate candidates. In that small amount of time, they need to get a quick sense of your education, professional experience, personal interests, skillset, and personality amongst other things.</p><p>The second essential piece of information is that they don’t know what you don’t tell them. They’re stressed for time already, and they’ll definitely not spend more time on your application if they’re not convinced by your presentation. You have to provide that information yourself.</p><p>This should not be too shocking in itself, but it’s surprising to me how many people don’t cater towards these conditions.</p><p>I’m willing to let you in on a little secret. One of the most helpful things that helps me select applicants are the very specific questions we ask in our job portal. Everyone applying for a developer job at our company needs to answer those. We’ll go through two of them to discover the reasons why these questions are being asked.</p><h4>Self Reflection.</h4><p>One of the questions I like to ask is the following:</p><p><em>“What makes you a great addition to our team?”</em></p><p>This question is all about showing the ability for self reflection. It’s an opportunity to tell me you realize what your strong points are. In what way do you see those strong suits complementing the team, or being of value to the company in general?</p><p>You could be a great team player. Maybe you have strong leadership skills. Do you have a background in mathematics or animation? I need to know what your <em>superpower</em> is, and I can only figure that out if you tell me!</p><p>If you don’t know the answer to this question yet, ask your current colleagues, friends or family to help you figure that out.</p><h4>Being Engaged in the Industry.</h4><p><em>“Which development(s) in the industry are you excited about?”</em></p><p>Honestly, this is by far my favorite question to ask! It’s very open and allows you to go in any direction with your answer. Sometimes, the answer to this question has persuaded me to invite people for an interview before I even opened their resume. One of my favorite answers to this question was this one:</p><blockquote>…the shift towards building and sharing accessible UI components becoming mainstream in open-source projects.</blockquote><p>Why do I like that answer so much?</p><ul><li>I can appreciate developers who understand accessibility as a high priority item;</li><li>It shows me a topic you really care about, which in turn helps me get to know you better;</li><li>It allows me to think of challenges within the company where you’d be a good fit;</li><li>It shows me you’re up-to-date on current affairs in the front-end community.</li></ul><h3>Demonstrate Your Value.</h3><p><em>Don’t just list your skills, show me what you did with them.</em></p><p>If you already have some professional experience, tell me more than just your seniority level and job title on your resumé or LinkedIn. Show me your tasks, your responsibilities. Give me highlights of what made you a valuable employee. What are some projects where you really made a difference? How did you get to that result? What was your biggest contribution to the company?</p><p>The dangers of not being specific enough about your responsibilities are either underestimation or overestimation of your skillset. Even worse, when being cryptic or dodging questions about your previous responsibilities, you come across as someone who’s either lazy, piggybacking on the success of others or has something to hide.</p><p>Also, if you feel like you’ve only played a small part in the team, don’t fret it! Honestly, I’d rather see you highlight a small, but interesting part of an application you took responsibility for than act shy about it. Take pride in the work you did, and show it off. We all know nobody builds these great systems on their own, so there’s absolutely no shame in being honest about what you did and didn’t work on.</p><h4><strong>In Closing.</strong></h4><p>Hiring managers have little time to make decisions, so make it as easy as you can for them to quickly get a feel for your worth as an employee. Think about what the person at the other end needs to know to make this decision, and provide it.</p><p>By the way, if this article has gotten you inspired, we are always looking to hire talent at CLEVER°FRANKE. So have a look at <a href="http://jobs.cleverfranke.com/">our job portal</a> and share your superpower with us.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9d5817b294d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/clever-franke/on-applying-for-a-job-d9d5817b294d">On Applying for a Job as a Developer</a> was originally published in <a href="https://medium.com/clever-franke">CLEVER°FRANKE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How We Test Client Web Projects With Minimum Effort For High Value]]></title>
            <link>https://medium.com/clever-franke/how-we-test-client-web-projects-with-minimum-effort-for-high-value-f855198c99f3?source=rss-4fbb279382ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/f855198c99f3</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Jan Hoogeveen]]></dc:creator>
            <pubDate>Wed, 16 Jan 2019 14:59:53 GMT</pubDate>
            <atom:updated>2019-01-16T16:04:18.758Z</atom:updated>
            <content:encoded><![CDATA[<h4>Testing web applications can be difficult and tedious. We’ll show you how to reduce the burden of testing and make it a more pleasurable experience.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUFwZ6PKoJ6SAV5gPC3QqQ.jpeg" /></figure><p>We’ve recently run into the issue of needing to refactor a large React app for a client. The app contains around 50 possible views with numerous variations because of a set of filters and user settings. The components we needed to refactor touch upon nearly all of those variations, so those refactored changes spread out across a huge surface area of the app.</p><p>After realizing we needed to check all these variations by hand — and a nerve wrecking push to production — we decided to re-evaluate our current testing practices, and introduce new testing practices to to our process.</p><h3>A Problem of Balance</h3><p>When working at an agency, it can be really hard to maintain balance; on one hand, you want to deliver features, and on the other, quality and adhering to best practices.</p><p>In an ideal world, you want to push new features to production every sprint, if not more often. However, the more complexity involved, the higher the risk of new features breaking other parts of your application.</p><p>You could hire a dedicated person to set up a quality checklist, maintain that list, and check off its boxes after every new release. While there is some merit to manual testing, it’s hardly a scaleable solution, and at best should be used in addition to automated tests.</p><p>This post describes how we, at CLEVER°FRANKE, approach testing while building interactive, web applications for our clients.</p><p><em>Context: most of our client projects are in active development at our studio for three to five months before we finish it and start a new project.</em></p><h3>Automated Testing</h3><p>I’m not going to write about the benefits of writing tests for your application. There are enough resources on the internet that explain the why. What’s more interesting is the practical approach of actually implementing automatic testing in real-life projects.</p><h4>Unit testing React components</h4><p>You could argue that a React component is a unit, and I’d agree to some extent, seeing as props go in and a representation of the updates DOM comes out. In that sense, let’s discuss how we unit test our React components.</p><p>We tried to do this vigorously at first using a combination of <a href="http://airbnb.io/enzyme/docs/api/shallow.html">shallow rendering tests</a> and <a href="https://airbnb.io/enzyme/docs/api/mount.html#full-rendering-api-mount">full-rendering tests</a> through Enzyme. We found while it’s not impossible to write valuable tests with Enzyme, our experience writing tests was just not so great. Instead of quickly writing a test and going on with our jobs, it felt like an eternal fight Jest and Enzyme all the time.</p><p>We made the decision to stop writing unit tests for React components. Not because we don’t value good tests, but because the effort of writing those tests was working against us.</p><p>Instead, we focused on writing unit tests for smaller, helper functions that are used throughout the application.</p><p>A good example of this is our <em>custom</em> number formatting helper used throughout the application. This is an isolated piece of functionality where we can assert a given input (a number) always returns an expected output (a string).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2ytSV5rA9v5jZVGW00Emg.png" /><figcaption>Unit tests for a custom helper function which takes a number as input and return a human readable string for the User Interface</figcaption></figure><h4>Snapshot testing</h4><p>We use the <a href="https://jestjs.io/docs/en/snapshot-testing">snapshot testing</a> feature, introduced by Jest in 2016, quite extensively, especially for <a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0">dumb components</a>, where we find it a match made in heaven.</p><p>When testing (UI) React components, what we care about is that when we feed-in specific props, our components return the expected DOM representations. Whenever the output of a component changes unexpectedly, that’s an indication of a bug, or we need to update our snapshots.</p><p>At first, we considered snapshot tests a ‘good enough’ replacement for writing tedious unit tests with Enzyme. However, several months later, we came to the conclusion that snapshot tests are in no way a suitable replacement for actual unit testing at all.</p><p>One particular case in which we found this valuable, and the only reason we still use snapshot tests today, is how it shows the direct impact of changes we introduce with styled-components. You can immediately see if changing the style of a component has unintended side-effects (or expected side-effects) on other components.</p><p>This is a powerful tool when composing styled components and using theme providers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UD62IJkTsJsl-ZL_2rneag.png" /><figcaption>Snapshot test of a custom React component extending React-Routers Link component with new functionality.</figcaption></figure><h4>Discovering react-testing-library</h4><p>A few months ago we discovered a library called <a href="https://github.com/kentcdodds/react-testing-library">react-testing-library</a>. Now, after trying it out in some projects, we came back on our decision to stop writing unit tests. We like it for a few reasons, but one of the biggest ones is convenience. Compared to Enzyme the API surface is <a href="https://testing-library.com/docs/api-queries">quite small</a>, and you only need to learn two or three methods to actually write valuable tests.</p><p>The library is built on the idea that a developer should test components in roughly the same way a real user would, without having to worry about implementation details. This ensures that you don’t need to rewrite your tests as soon as implementation details of React change. Better still, the API of react-testing-library makes writing these kind of unit tests relatively straightforward!</p><p>Getting started writing unit tests with this library is relatively easy and straightforward. It feels like a fresh start in our codebase and we recommend trying it out in your next projects!</p><h4>End-to-End testing</h4><p>Just testing the units or components alone does not cover everything. An application consists of many components working together. This is where naive state management or side-effects in your application can result in nasty bugs. Of course, this is exactly the issue we faced after a huge, refactoring sprint. We were certain the components in isolation were still working as expected thanks to the unit and snapshot tests. We were however, unsure if the application as a whole still worked as expected. This is where end-to-end testing shines.</p><p>We tried solving this in an automated fashion before. We even <a href="https://github.com/cleverfranke/cf-kyt-starter-universal-redux/blob/master/e2e.sh">added one E2E solution</a> to our now deprecated, <a href="https://github.com/cleverfranke/cf-kyt-starter-universal-redux">open-sourced starter package</a> for Universal React Applications. Unfortunately, we found none of those solutions really helpful in the end. They were either based on outdated browsers, lacking documentation, or simply too hard to configure and use. We’re looking for a solution that requires minimal effort from our developers to create really solid tests.</p><p>Thus, we reverted back to manual testing every single time. We’d prepare a new release of a product, deploy that to a QA environment, and invite people internally to break it. While we did squash a lot of bugs, this is an error-prone, repetitive, and not a scaleable solution.</p><p>After working on the recent refactoring round, we decided we needed a solution to solve this once and for all. What we want is an easy to use, documented, stable solution to test our complete application.</p><p>Eventually, we found Cypress.</p><h4>Painless end-to-end testing</h4><blockquote>Cypress is a next generation front end testing tool built for the modern web. We address the key pain points developers and QA engineers face when testing modern applications.</blockquote><p>Things that used to be hard using other solutions, are now really easy using Cypress. Stubbing external resources, waiting for data to load, providing sane timeouts for tests to fail, debugging, Cypress takes care of almost everything.</p><p>Here’s a screencast of cypress running basic tests in a GUI on the <a href="https://districtmobility.org/">District Department of Transportation</a> website, one of our client projects.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F278473889%3Fapp_id%3D122963&amp;dntp=1&amp;url=https%3A%2F%2Fplayer.vimeo.com%2Fvideo%2F278473889&amp;image=http%3A%2F%2Fi.vimeocdn.com%2Fvideo%2F711506422_1280.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=vimeo" width="1366" height="702" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d27e958bb6a38ef931c3834b5c29318/href">https://medium.com/media/5d27e958bb6a38ef931c3834b5c29318/href</a></iframe><p>The GUI is an amazing tool. It shows you an overview of available test scripts, it allows you to pause and resume testing, inspect the application you’re testing with a web inspector, and it even features time travel. Want to go back in time to see how your DOM looked in the middle of your test just before throwing an error? No problem!</p><p>Of course, a GUI is nice but E2E testing needs to happen on your continuous integration service as well. Cypress comes with a CLI mode, suitable for running tests in your <a href="https://docs.cypress.io/guides/guides/continuous-integration.html">CI/CD environment</a>. Implementing it is relatively easy thanks to the configuration examples.</p><p>We are always looking for the easiest solutions to test our web applications. In my opinion, using both react-testing-library and Cypress is a no-brainer for our current projects. Using these two tools, tests are easy to write, provide a lot of value and are easy to hook-up to your CI/CD provider.</p><p>Now, our team can rest assured knowing that their commits don’t break existing functionality and deploy with confidence.</p><p>If you’re curious about react-testing-library and Cypress, take a look at their sites.</p><ul><li><a href="https://testing-library.com/react">https://testing-library.com/react</a></li><li><a href="https://www.cypress.io/">https://www.cypress.io/</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f855198c99f3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/clever-franke/how-we-test-client-web-projects-with-minimum-effort-for-high-value-f855198c99f3">How We Test Client Web Projects With Minimum Effort For High Value</a> was originally published in <a href="https://medium.com/clever-franke">CLEVER°FRANKE</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>