<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>sven&#39;s blog</title>
    <link>https://sven.memcmp.org/</link>
    <description>Recent content on sven&#39;s blog</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Wed, 13 May 2026 06:59:00 +0200</lastBuildDate>
    <atom:link href="https://sven.memcmp.org/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Encoding mutations directly into the test code</title>
      <link>https://sven.memcmp.org/2026-05-13-encoding-mutations-directly-into-the-test-code/</link>
      <pubDate>Wed, 13 May 2026 06:59:00 +0200</pubDate>
      <guid>https://sven.memcmp.org/2026-05-13-encoding-mutations-directly-into-the-test-code/</guid>
      <description>&lt;p&gt;I sometimes annotate a test case with the (potential) mistake that caused me to introduce the test in the first place, as it can make it easier to understand why a test looks the way that it does.&lt;/p&gt;&#xA;&lt;p&gt;Consider the following module, written in &lt;a href=&#34;https://learn.microsoft.com/en-us/dotnet/fsharp/&#34;&gt;F#&lt;/a&gt;:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fsharp&#34; data-lang=&#34;fsharp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;open&lt;/span&gt; System&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#66d9ef&#34;&gt;module&lt;/span&gt; Validator &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    &lt;span style=&#34;color:#66d9ef&#34;&gt;let&lt;/span&gt; isAllowed &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;now&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; DateTime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;(&lt;/span&gt;date&lt;span style=&#34;color:#f92672&#34;&gt;:&lt;/span&gt; DateTime&lt;span style=&#34;color:#f92672&#34;&gt;)&lt;/span&gt; &lt;span style=&#34;color:#f92672&#34;&gt;=&lt;/span&gt; now&lt;span style=&#34;color:#f92672&#34;&gt;.&lt;/span&gt;Date &lt;span style=&#34;color:#f92672&#34;&gt;&amp;lt;=&lt;/span&gt; date&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;I might, for example, write the following comment inside of one of its test cases:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Testing complex high-level functions</title>
      <link>https://sven.memcmp.org/2026-03-22-testing-complex-high-level-functions/</link>
      <pubDate>Sun, 22 Mar 2026 09:09:00 +0100</pubDate>
      <guid>https://sven.memcmp.org/2026-03-22-testing-complex-high-level-functions/</guid>
      <description>&lt;p&gt;In &lt;a href=&#34;https://sven.memcmp.org/2025-08-14-you-probably-shouldnt-test-the-leafs-directly/&#34;&gt;You probably shouldn&amp;rsquo;t test the leafs directly, except when&amp;hellip;&lt;/a&gt;, I snuck in a pesky &amp;ldquo;reasonably&amp;rdquo; somewhere mid-sentence:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;If you can &lt;em&gt;reasonably&lt;/em&gt; test the entire tree by testing the root, then do it.&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;p&gt;What do you do if you &lt;em&gt;can&amp;rsquo;t&lt;/em&gt; reasonably test the entire tree by testing the root? Well, you write tests against some of your lower-level functions.&lt;/p&gt;&#xA;&lt;hr&gt;&#xA;&lt;p&gt;We can&amp;rsquo;t really stop there, though. You still need to the test the high-level functions somehow. How do you prevent the tests for your high-level function from becoming unbelievably complex?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Writing the steps to validate a test that already passes in the commit message</title>
      <link>https://sven.memcmp.org/2026-02-20-writing-the-steps-to-validate-a-test-that-already-passes-in-the-commit-message/</link>
      <pubDate>Fri, 20 Feb 2026 06:31:44 +0100</pubDate>
      <guid>https://sven.memcmp.org/2026-02-20-writing-the-steps-to-validate-a-test-that-already-passes-in-the-commit-message/</guid>
      <description>&lt;p&gt;I &lt;a href=&#34;https://sven.memcmp.org/2026-02-19-should-we-start-writing-verifiable-claims-in-commit-messages/&#34;&gt;previously argued&lt;/a&gt; that there is value in verifying that a commit that purports to add a failing test &lt;em&gt;actually&lt;/em&gt; adds a failing test, and that we might want to encode that information in the commit message somehow.&lt;/p&gt;&#xA;&lt;p&gt;What if, however, you want to insist on making what has sometimes been called &lt;a href=&#34;https://simonwillison.net/2022/Oct/29/the-perfect-commit/&#34;&gt;&amp;ldquo;The Perfect Commit&amp;rdquo;&lt;/a&gt;, which adds both the production code and the passing test at the same time?&lt;/p&gt;&#xA;&lt;p&gt;Or what if you&amp;rsquo;re simply writing a &lt;a href=&#34;https://en.wikipedia.org/wiki/Characterization_test&#34;&gt;Characterization Test&lt;/a&gt; for existing code, and are following some variation of the following recipe?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Should we start writing verifiable claims in commit messages?</title>
      <link>https://sven.memcmp.org/2026-02-19-should-we-start-writing-verifiable-claims-in-commit-messages/</link>
      <pubDate>Thu, 19 Feb 2026 19:28:08 +0100</pubDate>
      <guid>https://sven.memcmp.org/2026-02-19-should-we-start-writing-verifiable-claims-in-commit-messages/</guid>
      <description>&lt;p&gt;Whether or not every commit should build and pass all of its tests is, arguably, a contentious issue:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Every commit should be runnable, that is we should be able to git checkout any commit and get a functional code base. This means no “WIP” commits or commit chains that only restore functionality at the end.&#xA;&lt;br&gt;&#xA;&lt;br&gt;&#xA;— &lt;a href=&#34;https://blog.sulami.xyz/posts/cleaning-up-git-history/&#34;&gt;Cleaning Up Git History&lt;/a&gt;, Robin Schroer&lt;/p&gt;&#xA;&lt;/blockquote&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Within a feature branch, not every commit necessary passes the tests (or even builds), and that is a useful property! Here’s some ways this can be exploited:&lt;/p&gt;</description>
    </item>
    <item>
      <title>You probably shouldn&#39;t test the leafs directly, except when...</title>
      <link>https://sven.memcmp.org/2025-08-14-you-probably-shouldnt-test-the-leafs-directly/</link>
      <pubDate>Thu, 14 Aug 2025 10:28:58 +0200</pubDate>
      <guid>https://sven.memcmp.org/2025-08-14-you-probably-shouldnt-test-the-leafs-directly/</guid>
      <description>&lt;p&gt;Focus on unit tests, but relax the definition of what a &amp;ldquo;unit&amp;rdquo; is.&lt;/p&gt;&#xA;&lt;p&gt;It shouldn&amp;rsquo;t be language constructs (such as classes or methods) that dictate how much a unit test is allowed to cover, but rather the &lt;em&gt;complexity&lt;/em&gt; of the code that you&amp;rsquo;re testing. You can often achieve the exact same test coverage and the exact same &lt;a href=&#34;https://stryker-mutator.io/docs/&#34;&gt;mutation&lt;/a&gt; resistance by testing your program at a slightly higher level, and you will get a lot to show for it.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
