<?xml version='1.0' encoding='utf-8' ?>

<rss version='2.0' xmlns:lj='http://www.livejournal.org/rss/lj/1.0/' xmlns:atom10='http://www.w3.org/2005/Atom'>
<channel>
  <title>Kevin Reid&apos;s blog</title>
  <link>https://kpreid.dreamwidth.org/</link>
  <description>Kevin Reid&apos;s blog - Dreamwidth Studios</description>
  <lastBuildDate>Wed, 19 Jul 2023 23:40:09 GMT</lastBuildDate>
  <generator>LiveJournal / Dreamwidth Studios</generator>
  <lj:journal>kpreid</lj:journal>
  <lj:journaltype>personal</lj:journaltype>
  <image>
    <url>https://v2.dreamwidth.org/12362995/3165654</url>
    <title>Kevin Reid&apos;s blog</title>
    <link>https://kpreid.dreamwidth.org/</link>
    <width>100</width>
    <height>100</height>
  </image>

<item>
  <guid isPermaLink='true'>https://kpreid.dreamwidth.org/55795.html</guid>
  <pubDate>Wed, 19 Jul 2023 23:40:09 GMT</pubDate>
  <title>Tests must document what they are testing for</title>
  <link>https://kpreid.dreamwidth.org/55795.html</link>
  <description>&lt;p&gt;While I worked at Google I spent a lot of time doing testing and code review. One of the things I learned from this is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A test must document what it is testing.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This doesn’t have to be an explicit comment (it might be adequately explained by the name of the test, or the code in it), but either way, it should be obvious to maintainers what the goal of the test is — what property the code under test should have. “This test should continue to pass” is not a sufficient explanation of the goal. Why? Consider these scenarios:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A test failed. Does that mean…&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;…the test successfully detected the loss of a desired behavior? 
(This is the ideal case, that we hope to enable by writing and running tests.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;…the test incidentally depended on something that is changing but is not significant, such as ordering of something unordered-but-deterministic, or the exact sequence of some method calls?
(Ideally, test assertions will be written precisely so that they accept everything that meets requirements, but this is not always feasible or correctly anticipated.)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;…the test incidentally depended on something that is being intentionally changed, but it wasn’t intending to test that part of the system, which has its own tests?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;A test no longer compiles because you deleted a function (or other declaration/item/symbol) it used. Does that mean…&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;p&gt;…the test demonstrates a reason why you should not delete that function?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;…the test needs to be rewritten to test the thing it is about, without incidentally using that function?&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;…the function is necessary to perform this test, so it should continue to exist but be private?&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;If tests specify the property they are looking for, then maintainers can quickly decide how to respond to a test failure — whether to count it a bug in the code under test, or to change or delete the test.&lt;/p&gt;

&lt;p&gt;If they do not, then maintainers will waste time keeping the code conformant to obsolete requirements, or digging through revision history to determine the original intent.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=kpreid&amp;ditemid=55795&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://kpreid.dreamwidth.org/55795.html</comments>
  <category>google</category>
  <category>programming</category>
  <category>testing</category>
  <lj:security>public</lj:security>
  <lj:reply-count>0</lj:reply-count>
</item>
<item>
  <guid isPermaLink='true'>https://kpreid.dreamwidth.org/55189.html</guid>
  <pubDate>Sat, 06 May 2023 21:47:54 GMT</pubDate>
  <title>end and beginning</title>
  <link>https://kpreid.dreamwidth.org/55189.html</link>
  <description>&lt;p&gt;One month ago, April 7, 2023, I left my job at Google.

&lt;p&gt;At the time, I was working on &lt;a href=&quot;https://earthengine.google.com/&quot;&gt;Earth Engine&lt;/a&gt; — “a planetary-scale platform for Earth science data &amp;amp; analysis”, or if you&apos;re looking at it through my lens, a cloud computing service which interprets parallel, pure-functional programs interleaved with image processing and database queries. (It’s a really interesting system, and if you&apos;d like to check it out yourself, it&apos;s free for non-commercial use. Play with big data and make interesting pictures!)

&lt;p&gt;One of the elements of the plan I made for the future after this choice was that, this year, I would get to take some time to pursue my personal projects and interests unencumbered by “having a day job” or intellectual property contracts — and I have been doing that.

&lt;p&gt;Now, as you can see from the fact that my blog is as silent the last month as it has been for the last two years, that didn&apos;t instantly bring back all the energy for blogging I had in 2012. But, step one is to break the awkward silence. Step two is to post about stuff I&apos;ve been doing. Maybe someday I&apos;ll get to step “update my website”.&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img src=&quot;https://www.dreamwidth.org/tools/commentcount?user=kpreid&amp;ditemid=55189&quot; width=&quot;30&quot; height=&quot;12&quot; alt=&quot;comment count unavailable&quot; style=&quot;vertical-align: middle;&quot;/&gt; comments</description>
  <comments>https://kpreid.dreamwidth.org/55189.html</comments>
  <category>google</category>
  <category>life</category>
  <lj:security>public</lj:security>
  <lj:reply-count>2</lj:reply-count>
</item>
</channel>
</rss>
