<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Adèle Gauvrit</title>
    <description>The latest articles on Forem by Adèle Gauvrit (@adelegauvrit).</description>
    <link>https://forem.com/adelegauvrit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F465774%2F31a61c57-b536-4dbc-9337-139954deef18.jpg</url>
      <title>Forem: Adèle Gauvrit</title>
      <link>https://forem.com/adelegauvrit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/adelegauvrit"/>
    <language>en</language>
    <item>
      <title>Kumo becomes Serverless By Theodo ☁️</title>
      <dc:creator>Adèle Gauvrit</dc:creator>
      <pubDate>Fri, 04 Aug 2023 15:03:54 +0000</pubDate>
      <link>https://forem.com/slsbytheodo/kumo-becomes-serverless-by-theodo-5d6e</link>
      <guid>https://forem.com/slsbytheodo/kumo-becomes-serverless-by-theodo-5d6e</guid>
      <description>&lt;p&gt;I am thrilled to announce a significant transformation in our brand as Kumo evolves into &lt;strong&gt;Serverless by Theodo&lt;/strong&gt;. Over the years, the Kumo team has grown and shared here our learnings and achievements in the field of Serverless. Now, we are taking the next big step to enhance our platform and naming our blog after our Mother Company &lt;a href="https://www.theodo.fr/"&gt;Theodo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Rest assured, while our name evolves, the recipe remains unchanged. If anything, this rebranding allows us to better communicate our values and focus on providing you with even more insightful and relevant articles on serverless computing.&lt;/p&gt;

&lt;p&gt;The whole team is incredibly grateful for your support the past 2 years. We are looking forward to embarking on this new chapter as Serverless By Theodo. As always, your feedback and suggestions are essential to us. Reach out to us with any comments or ideas you may have.&lt;/p&gt;

&lt;p&gt;Together, let's continue our journey to better serverless computing with Serverless by Theodo!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A serverless solution to just-in-time scheduling</title>
      <dc:creator>Adèle Gauvrit</dc:creator>
      <pubDate>Thu, 09 Jun 2022 13:30:51 +0000</pubDate>
      <link>https://forem.com/slsbytheodo/a-serverless-solution-to-just-in-time-scheduling-3cn6</link>
      <guid>https://forem.com/slsbytheodo/a-serverless-solution-to-just-in-time-scheduling-3cn6</guid>
      <description>&lt;p&gt;&lt;em&gt;TL; DR: We published a &lt;strong&gt;CDK construct&lt;/strong&gt; to schedule events precisely.&lt;br&gt;
Documentation is available on &lt;a href="https://github.com/guiyom-e/cdk-scheduler" rel="noopener noreferrer"&gt;the project's github&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;When I worked on a serverless CMS with Guillaume, we had to find a way to schedule an event (publishing a new article)&lt;br&gt;
at a precise time with serverless tools. AWS doesn't offer a built-in service to do so. We found straight-forward options but none as precise as we wished. We came up with a solution of our own. We published a CDK construct for you to add our solution to your stack without boilerplate.&lt;/p&gt;

&lt;h1&gt;
  
  
  Naive approaches to serverless scheduling
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Scheduling a lambda to run every minute
&lt;/h2&gt;

&lt;p&gt;A first approach is to use &lt;strong&gt;lambda schedule trigger&lt;/strong&gt; feature. Lambdas can be triggered every down to every minute.&lt;br&gt;
Every minute, you can query your database to find if any events need to be published now. If so, run the action you planned (like publishing an article), else do nothing.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcq1ip7thm7n88iey59an.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcq1ip7thm7n88iey59an.jpg" alt="Trigger a lambda every minute to check if any events needs to be scheduled"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A lambda can be triggered down to every minute and the trigger time has a &lt;strong&gt;one-minute precision&lt;/strong&gt; guarantee. It's good enough for some use-cases but not if you are looking for a highly precise method.&lt;/p&gt;

&lt;h2&gt;
  
  
  Using DynamoDB time-to-live and streams
&lt;/h2&gt;

&lt;p&gt;DynamoDB comes with a time-to-live feature. You can add a &lt;strong&gt;&lt;code&gt;ttl&lt;/code&gt; attribute&lt;/strong&gt; to an entry. At said time, AWS will remove the entry form your table. If you have a stream plugged to your table you can play an action at scheduled time.&lt;/p&gt;

&lt;p&gt;However, this approach is &lt;strong&gt;even less precise&lt;/strong&gt; than the first. AWS only guarantees a forty-eight-hour precision on the time-to-live date. In practice, users observe a ten-minute delay but it's not guaranteed. If, like us, you work on time-sensitive events, you will want to avoid this method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76l5ot82fxk1co62g15y.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F76l5ot82fxk1co62g15y.jpg" alt="Use Dynaomdb time-to-live feature to trigger events with one-day precision"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introducing cdk-scheduler
&lt;/h1&gt;

&lt;p&gt;To match our just-in-time ambition, we leveraged the SQS delay feature. When publishing on an SQS queue you can set a delay that goes up to fifteen minutes.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8fpcw4x9wumsdm5fb20i.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8fpcw4x9wumsdm5fb20i.jpg" alt="cdk-scheduler leverages SQS delay feature to trigger events precisely"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Instead of starting a lambda every minute, we do it every fifteen minutes, which reduces fixed costs. This method has a &lt;strong&gt;one-second precision gap&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;In case you're in hurry to schedule, we also added a "near-future" handler: a second lambda is plugged on a DynamoDB stream. It handles events that are to be scheduled in less than fifteen minutes after their creation and pushes them directly on the SQS with a delay. This edge case is just as precise.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pricing
&lt;/h2&gt;

&lt;p&gt;CDK-scheduler lambda calls are low. Fixed costs for lambda execution is $0.06/month. Regarding variable costs, CDK-scheduler costs $2.50 for one million scheduled events&lt;br&gt;
($1.25 to put your items in DynamoDB and $1.25 to delete them, SQS is free for the first million events).&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Solution&lt;/th&gt;
&lt;th&gt;Fixed costs (per month)&lt;/th&gt;
&lt;th&gt;Variable costs (one million events)&lt;/th&gt;
&lt;th&gt;Precision&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;CDK-schedluer&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0.05&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;1 second&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Scheduled lambda&lt;/td&gt;
&lt;td&gt;$0.80&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;2 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;DynamoDB Time to leave&lt;/td&gt;
&lt;td&gt;$0&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;1 day&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  What's next?
&lt;/h1&gt;

&lt;p&gt;Our construct is now published. Documentation is available on &lt;a href="https://github.com/guiyom-e/cdk-scheduler" rel="noopener noreferrer"&gt;our open-source repository&lt;/a&gt;. If you would like to try it on your project run &lt;code&gt;yarn add cdk-scheduler&lt;/code&gt;. It fits the need we had when we developed a CMS like a glove. We're now looking for your feedback. What do you need when scheduling an event? What configuration or features would you like to see?&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Cover photo by &lt;a href="https://unsplash.com/@alex_vicol?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;alexandru vicol&lt;/a&gt; on Unsplash&lt;/em&gt;&lt;/p&gt;

</description>
      <category>serverless</category>
      <category>cdk</category>
      <category>aws</category>
    </item>
    <item>
      <title>Write tests for Humans</title>
      <dc:creator>Adèle Gauvrit</dc:creator>
      <pubDate>Tue, 08 Sep 2020 16:31:42 +0000</pubDate>
      <link>https://forem.com/adelegauvrit/write-tests-for-humans-2nl1</link>
      <guid>https://forem.com/adelegauvrit/write-tests-for-humans-2nl1</guid>
      <description>&lt;p&gt;Let me tell you the story of the day I almost quit testing my code altogether.&lt;br&gt;
For the tenth times this week, the CI failed with this cryptic error message "Received value does not match stored snapshot" and a diff that looked something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div
  - className="myClassName" &amp;gt;
  + className="myNewClassName" &amp;gt;
  + &amp;lt;div&amp;gt;
    Hello world
  + &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It felt pointless to fix this test : why does it matter if the class-name is different or I added a div tag?&lt;br&gt;
It does not keep me from introducing regressions as nobody in the team reads the snapshots updates.&lt;/p&gt;

&lt;p&gt;I was so frustrated, I almost broke the computer, slammed the door to quit my job.&lt;br&gt;
But instead, I decided to channel this energy into something more positive.&lt;br&gt;
I started thinking about how the project tests got into such a state.&lt;/p&gt;

&lt;p&gt;How come everybody agrees that we need to test our code base yet so many developers hate it?&lt;br&gt;
Was I the only one being frustrated? (&lt;em&gt;No I was not&lt;/em&gt;)&lt;/p&gt;


&lt;blockquote&gt;
&lt;p&gt;When people say they use TDD, I don’t believe them.&lt;/p&gt;— emily freeman (&lt;a class="mentioned-user" href="https://dev.to/editingemily"&gt;@editingemily&lt;/a&gt;) &lt;a href="https://twitter.com/editingemily/status/1298679608489852930?ref_src=twsrc%5Etfw"&gt;August 26, 2020&lt;/a&gt;
&lt;/blockquote&gt; 

&lt;p&gt;Why is nobody doing something about this?&lt;/p&gt;

&lt;h2&gt;
  
  
  The Vicious Circle Theory or How you stopped writing test for humans
&lt;/h2&gt;

&lt;p&gt;Here is my theory to make sense of this kind of situation.&lt;br&gt;
I have called it &lt;strong&gt;"The vicious circle of testing"&lt;/strong&gt; ™:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A Developer changes the code for a feature. &lt;strong&gt;A test fails, but it is not clear why&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;The Developer fixes the test.
They do not know why the test was here in the first place.
They grow used to the idea that it is not worth their time investment to fix it.&lt;/li&gt;
&lt;li&gt;Next time, this developer writes code, they spend less time and effort writing tests.&lt;/li&gt;
&lt;li&gt;And back to the top...&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--PNRI13Kk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cfk0ttlbr04g76vmr3en.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--PNRI13Kk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/cfk0ttlbr04g76vmr3en.jpg" alt="Circle of bad tests" width="740" height="416"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If this resonates with you, you've been writing tests for the CI to work but not for your teammates to understand your intent.&lt;br&gt;
Tests are a collaboration tool, they are meant to be read when they fail by you of your teammates.&lt;br&gt;
You need to make sure you can understand them in a month when you have forgotten all about what you were supposed to do.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Tests are meant to be read by humans, not your CI.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;How do you write tests for humans, you ask?&lt;br&gt;
Here are my 3 tips for you :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Why&lt;/strong&gt;: You need to know why you are testing. Because testing is a universal truth in software engineering, it is easy to forget why you need to do it on your project. Find what motivates you: it will guide you to write good tests that you want other humans to read.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What&lt;/strong&gt;: You need to focus. I think it is better to do one thing well rather than try to do it all and do it mediocrely. Choose what you want to test, do not try to test it all.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How&lt;/strong&gt;: Choose the best tools adapted to your goal. They must help you write quality tests that you can read and maintain&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  #1: Why do you write tests?
&lt;/h2&gt;

&lt;p&gt;Writing great tests for humans takes time, you need to be invested in what you are doing.&lt;br&gt;
You cannot be if you do not know exactly why you need to write great tests.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not write tests because you have to. Make sure you and your team know why you write tests.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Automatic testing is often a given when setting up quality tools for your project.&lt;br&gt;
Unlike your linter, tests do not fail every day, they are a longer-term investment to code quality.&lt;br&gt;
It is easy to lose sight of why you are doing it.&lt;/p&gt;

&lt;p&gt;Before starting to set up your test environment you should clarify why you are testing.&lt;/p&gt;

&lt;p&gt;What are you hoping to gain in the long term?&lt;br&gt;
Better documentation?&lt;br&gt;
Fewer regressions bugs? Developer experience tool for TDD?&lt;/p&gt;

&lt;p&gt;Make sure you and your team know why you are doing it. Because it is so easy to fall into the vicious circle of bad testing, if you all know why you are driven to write tests, you can catch early when you are deviating from your goal. Making your goal clear will give your teammates &lt;strong&gt;ownership&lt;/strong&gt; over your test and they will help you push for improvements when needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  #2: Choose what parts need to be tested first
&lt;/h2&gt;

&lt;p&gt;If we chose to use snapshots on my project, it was to go faster.&lt;br&gt;
We wanted to test all of the codebase without investing much time.&lt;br&gt;
By aiming to keep a 100% coverage, we started writing tests that needed to be maintained every time we added features. They could not help us catch regressions because they changed too often.&lt;br&gt;
No matter how small the investment was, it was not worth it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Do not aim for a 100% code-coverage of generic tests, aim for 100% of readable tests&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;You do not need to test everything.&lt;br&gt;
Your set up may not be adapted to every aspect of your code.&lt;/p&gt;

&lt;p&gt;I always write unit tests for very logical functions :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They are hard to read and easy to break. A test is a safeguard to make sure another developer will not break it.&lt;/li&gt;
&lt;li&gt;It is cheap to set up and to write.&lt;/li&gt;
&lt;li&gt;It is fast so it does not slow down the ci.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But for most part of the code, it is a case-by-case study.&lt;/p&gt;

&lt;p&gt;Should I test my frontend app UX?&lt;br&gt;
If I am writing a complex single-page app, UX is very likely to evolve.&lt;br&gt;
Testing it may be my priority so I can prevent regressions that have a big impact on the user's appreciation of my app.&lt;br&gt;
I want to write integration or end-to-end tests for this.&lt;/p&gt;

&lt;p&gt;Should I test your frontend app UI?&lt;br&gt;
If I am writing a shared-component library, I am focusing on UI and have a few logical components.&lt;br&gt;
My first mission is to provide my users with reliable and consistent UI.&lt;br&gt;
Testing UX logic is a bonus, it is ok to make choices and not to focus on this at first.&lt;/p&gt;

&lt;h2&gt;
  
  
  #3 Choose your tools right
&lt;/h2&gt;

&lt;p&gt;There are a lot of great testing tools available.&lt;br&gt;
Now that you know why you want to write tests and what parts of code you want to focus on, you can find the tools that fit your needs like a glove&lt;/p&gt;

&lt;p&gt;On another project, I chose to test my frontend React app with react-testing-library.&lt;br&gt;
I wanted a tool that :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;would test our React app components logic and document what they did&lt;/li&gt;
&lt;li&gt;would help new developers feel confident when starting on the project&lt;/li&gt;
&lt;li&gt;would help us focus on these goals even if the teams changed&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is why I chose react-testing-library to write integrations tests on it.&lt;br&gt;
It turned out to be a great developer experience.&lt;br&gt;
I also had a personal goal of trying this new tool that had a lot of great reviews.&lt;/p&gt;

&lt;p&gt;Find a tool that makes writing test fun, or that makes you want to do test-driven-development, you will only write tests for humans this way.&lt;/p&gt;

&lt;h1&gt;
  
  
  You are ready!
&lt;/h1&gt;

&lt;p&gt;Now you know: if you ever find yourself thinking testing is useless or painful to maintain, you are probably in a very vicious circle of testing.&lt;br&gt;
If you want to escape this, here are the steps to follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Remember tests are a documentation and collaboration tool, they should be made to be maintained by teams and read by humans&lt;/li&gt;
&lt;li&gt;Make sure your team knows why you are writing tests.
This will motivate you to write good tests that you can be proud of.&lt;/li&gt;
&lt;li&gt;Do not try to do it all.
Coverage is just a number, it is not a token of code quality.
Focus on testing some parts well rather than all of it in a poor way.&lt;/li&gt;
&lt;li&gt;Choose the tool that fits you and that makes the developer experience fun&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
