<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
  
  <title>Joe Smith&#39;s Blog</title>
  <subtitle>I&#39;m a software engineer stoked about Open Source Software &amp; scalable infrastructure.</subtitle>
  <link href="https://bjoli.com/feed/feed.xml" rel="self" />
  <link href="https://bjoli.com/" />
  <updated>2016-10-24T00:00:00Z</updated>
  <id>https://bjoli.com/</id>
  <author>
    <name>Joe Smith</name>
    <email>yasumoto7@gmail.com</email>
  </author>
  <entry>
    <title>Pathfinder Society</title>
    <link href="https://bjoli.com/posts/pathfinder/" />
    <updated>2016-10-24T00:00:00Z</updated>
    <id>https://bjoli.com/posts/pathfinder/</id>
    <content type="html">&lt;div id=&quot;content&quot;&gt;
&lt;p&gt;I love to step away from the computer to play the tabletop roleplaying game,
   &lt;a href=&quot;http://paizo.com/pathfinder&quot;&gt;Pathfinder&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;bay-area-pathfinder-society&quot;&gt;Bay Area Pathfinder Society&lt;/h2&gt;
&lt;p&gt;I&#39;m a &lt;a href=&quot;http://paizo.com/people/Yasumoto&quot;&gt;Venture Lieutenant for San Francisco&lt;/a&gt;,
   which means I help organize events and conventions, in addition to
   &lt;a href=&quot;https://www.facebook.com/BayAreaPathfinderSociety&quot;&gt;running our Facebook page&lt;/a&gt;.
   If you&#39;re in the San Francisco Bay Area, there are a lot of great games hosted by the
   &lt;a href=&quot;https://bayareapathfinder.com&quot;&gt;Bay Area Pathfinder Society&lt;/a&gt;! In particular,
   &lt;a href=&quot;https://warhorn.net/events/endgame&quot;&gt;Endgame in Oakland&lt;/a&gt; hosts events on Monday
   evenings, and &lt;a href=&quot;https://warhorn.net/events/gamescape-sf-pfs&quot;&gt;Gamescape in San Francisco&lt;/a&gt;
   hosts a Saturday game day each month.&lt;/p&gt;
&lt;h2 id=&quot;publications&quot;&gt;Publications&lt;/h2&gt;
&lt;p&gt;Zenith Games recently published
   &lt;a href=&quot;http://zenithgames.blogspot.com/2016/10/the-colossal-creatures-bestiary.html&quot;&gt;The Colossal Creatures Bestiary&lt;/a&gt;
   which contains a massive Raccoon-like creature I designed called a &lt;i&gt;Procyon&lt;/i&gt;! It was a great
   experience to work with that group, and it&#39;s available
   &lt;a href=&quot;http://paizo.com/products/btpy9p9l/discuss?The-Colossal-Creatures-Bestiary&quot;&gt;on the Paizo webstore&lt;/a&gt;
   if you&#39;d like to take a look!&lt;/p&gt;
&lt;p&gt;The fine folks behind &lt;a href=&quot;http://paizo.com/products/btpy9e73?Wayfinder-13&quot;&gt;Wayfinder #13&lt;/a&gt;
   also published my description of two characters based in the city of Caliphas! Spanning two
   pages and 1500 words, you can read about both &lt;a href=&quot;https://bjoli.com/images/wayfinder_13_almira.jpg&quot;&gt;Captain Almira Perine&lt;/a&gt;
   and &lt;a href=&quot;https://bjoli.com/images/wayfinder_13_liald.jpg&quot;&gt;Captain Liald Gaspair&lt;/a&gt;! The character art is by the
   &lt;a href=&quot;http://bobgreyvenstein.deviantart.com&quot;&gt;amazing Bob Greyvenstein&lt;/a&gt;.
&lt;/p&gt;
&lt;/div&gt;
</content>
  </entry>
  <entry>
    <title>Axes of Testing</title>
    <link href="https://bjoli.com/posts/axes_of_testing/" />
    <updated>2016-07-21T00:00:00Z</updated>
    <id>https://bjoli.com/posts/axes_of_testing/</id>
    <content type="html">&lt;div id=&quot;content&quot;&gt;
&lt;h1 style=&quot;color: grey;&quot; id=&quot;axes-of-testing&quot;&gt;Axes of Testing&lt;/h1&gt;
  &lt;p&gt;I&#39;ve tried many different tacks when explaining the benefits of unit testing to other
     developers (and proving to myself that they are worth it). Tests are not a silver bullet,
     they are just another tool in your war chest, and certainly have their limitations. What
     follows is the best breakdown I&#39;ve come up with to describe the various types of tests and
     when to lean on them. I presented this at a Twitter-internal Python tech talk, and many
     teammates nudged me to publish it externally. I hope it will allow others to understand how
     to approach adding different types of tests for your codebase.&lt;/p&gt;
&lt;h2 id=&quot;the-spectrum-of-testing&quot;&gt;The Spectrum of Testing&lt;/h2&gt;
  &lt;p&gt;&lt;i&gt;Big and Small, Real and Fake&lt;/i&gt;&lt;/p&gt;
  &lt;p&gt;Initially, I started using a single axis to try to delineate between &quot;small&quot; unit tests and
     &quot;widely-scoped&quot; integration tests. This wasn&#39;t effective, as I got lost when trying to figure
     out how to deal with moving away from real dependencies (sending prod traffic to other
     services) vs. making sure I replaced those interactions with mocks or fakes so I could still
     run my tests on an airplane.&lt;/p&gt;
  &lt;p&gt;This helped me realize that I was actually staring at (at least) a two dimensional spectrum,
     and thus the axes were born.&lt;/p&gt;
  &lt;h2 id=&quot;axes&quot;&gt;Axes&lt;/h2&gt;
  &lt;p&gt;&lt;img alt=&quot;bare axes&quot; style=&quot;max-width: 100%; height: auto; width: auto;&quot; src=&quot;https://bjoli.com/images/01_axes.png&quot; width=&quot;512&quot; height=&quot;384&quot;&gt;&lt;/p&gt;
  &lt;h3 id=&quot;horizontal&quot;&gt;Horizontal&lt;/h3&gt;
    &lt;p&gt;The first, horizontal axis covers whether or not you&#39;re sending traffic to live
       production, or just mocked out services. If you run &lt;code&gt;curl http://twitter.com&lt;/code&gt;,
       then you&#39;re hitting Twitter&#39;s website. However, if you change
       your &lt;code&gt;/etc/hosts&lt;/code&gt; file to instead point that hostname to your localhost where
       you&#39;re running a web server, then you&#39;ve taken a step away from &quot;production&quot; and toward a
       faked out &lt;a href=&quot;http://twitter.com&quot;&gt;twitter.com&lt;/a&gt;.
  &lt;/p&gt;&lt;h3 id=&quot;vertical&quot;&gt;Vertical&lt;/h3&gt;
    &lt;p&gt;The second, vertical axis is used to show the &quot;size&quot; of a test— how much of the system is
       exercised when executed? Using that &lt;code&gt;curl&lt;/code&gt; example above, that is a test that
       sweeps the gamut of infrastructure. It ensures that the &lt;code&gt;curl&lt;/code&gt; binary is
       installed on your system, your machine is connected to the Internet (with DNS, etc.), but
       also that Twitter&#39;s front-end infrastructure is serving correctly. This requires all of
       those pieces to work, and an error in one component will cause a failure for the entire
       test.&lt;/p&gt;
    &lt;p&gt;At the low end, you have a test which is akin to a shell script called &lt;code&gt;./curl&lt;/code&gt;
       which just ensures you pass in &lt;code&gt;http://twitter.com&lt;/code&gt; as the only argument. This
       isolates your execution from all other variables than just the way you&#39;re calling
       &lt;code&gt;curl&lt;/code&gt;, but the downside is you&#39;re not really ensuring that you are using things
       correctly. If, for instance, &lt;code&gt;curl&lt;/code&gt; gets updated to change the way it takes a
       URI for an argument, then you won&#39;t notice by running your test script, since it&#39;s not
       actually invoking &lt;code&gt;curl&lt;/code&gt; at all. Also, if (heaven forbid..)
       &lt;a href=&quot;http://twitter.com&quot;&gt;twitter.com&lt;/a&gt; goes down or moves locations, you won&#39;t notice
       that either.&lt;/p&gt;
  &lt;h2 id=&quot;extremes&quot;&gt;Extremes&lt;/h2&gt;
  &lt;p&gt;Let&#39;s take a look at what would happen if we just followed some of these options to the max&lt;/p&gt;
  &lt;p&gt;&lt;img alt=&quot;extremes&quot; style=&quot;max-width: 100%; height: auto; width: auto;&quot; src=&quot;https://bjoli.com/images/02_the_extremes.png&quot; width=&quot;512&quot; height=&quot;384&quot;&gt;&lt;/p&gt;
  &lt;h3 id=&quot;brittle&quot;&gt;Brittle&lt;/h3&gt;
    &lt;p&gt;If you are testing the whole end-to-end pipeline of a task, then a small break in any piece
       will grind your entire test to breakage. Large, broken test suites are tough to debug
       because you won&#39;t be able to tell which component is causing your failure without looking
       at the error message in detail.&lt;/p&gt;
  &lt;h3 id=&quot;dependent-services&quot;&gt;Dependent Services&lt;/h3&gt;
    &lt;p&gt;If you have a service which has zero mocks, and fully depends on all of production
       responding and working at all times, then it will break &lt;i&gt;anytime&lt;/i&gt; there is an issue
       with any small piece. Many downstreams in a test can be difficult to keep running
       frequently and reliably without a ton of work to ensure they are all stable.&lt;/p&gt;
  &lt;h3 id=&quot;interaction-validation&quot;&gt;Interaction Validation&lt;/h3&gt;
    &lt;p&gt;If you have very small-scoped tests, then you may miss huge interaction problems, and may
       not realize that you are sending the wrong format of data between various services, or
       perhaps are not rate-limiting the total number of requests (or any of an infinite number)
       of interactions.&lt;/p&gt;
  &lt;h3 id=&quot;no-confidence&quot;&gt;No Confidence&lt;/h3&gt;
    &lt;p&gt;If everything is mocked out, then you&#39;re spending all your effort on re-building
       infrastructure and pieces, without gaining any benefits of testing the actual systems you
       care about!&lt;/p&gt;
  &lt;h2 id=&quot;worst-of-all-worlds&quot;&gt;Worst of All Worlds&lt;/h2&gt;
  &lt;p&gt;We can get even worse by blindly combining some of these ideas as well!&lt;/p&gt;
  &lt;p&gt;&lt;img alt=&quot;bad ideas&quot; style=&quot;max-width: 100%; height: auto; width: auto;&quot; src=&quot;https://bjoli.com/images/03_worst_of_all_worlds.png&quot; width=&quot;512&quot; height=&quot;384&quot;&gt;&lt;/p&gt;
  &lt;h3 id=&quot;testing-in-production&quot;&gt;Testing In Production&lt;/h3&gt;
    &lt;p&gt;If you want to ensure you&#39;re causing problems for your users, throw some additional monkey
       wrenches into the works. This isn&#39;t the same as Netflix&#39;s Chaos Monkey; I&#39;m talking about
       throwing brand-new, un-vetted code into production so your customers detect the issues at
       the same time you do. Do not send huge request loads onto your brand new systems without
       even validating they pass health checks first!&lt;/p&gt;
  &lt;h3 id=&quot;submit-queue&quot;&gt;Submit Queue&lt;/h3&gt;
    &lt;p&gt;If you have many small tests that all hit various portions of live infrastructure, you will
       assuredly find lots of broken pieces over time. This will be a constant drag on
       productivity, as engineers will never quite know if the production service is having an
       issue or the code they just wrote is broken without investigation.&lt;/p&gt;
  &lt;h3 id=&quot;api-changes&quot;&gt;API Changes&lt;/h3&gt;
    &lt;p&gt;If you have many, small tests and mock everything out, then you won&#39;t actually see what
       big interface changes happen between modules or services. This will lead you to writing a
       lot of tests that don&#39;t verify anything, and not prevent you from changing the wrong thing
       which breaks a big service and takes the site down.&lt;/p&gt;
  &lt;h3 id=&quot;maintaining-mock-services&quot;&gt;Maintaining Mock Services&lt;/h3&gt;
    &lt;p&gt;If you want to have an equally-staffed Testing Team who shadows your &quot;primary&quot; team of
       developers, then you can likely manage to build a &quot;stack in a box&quot; and build the massive
       fleet required to mock out all of your services and keep up with changes. Otherwise,
       probably not worth the time investment.&lt;/p&gt;
  &lt;h2 id=&quot;unit-tests-and-integration-tests&quot;&gt;Unit Tests and Integration Tests&lt;/h2&gt;
  &lt;p&gt;I believe that by taking a middle path between these extremes, we can come up with two groups
     of tests that will make developers lives much better.&lt;/p&gt;
  &lt;p&gt;&lt;img alt=&quot;compromises&quot; style=&quot;max-width: 100%; height: auto; width: auto;&quot; src=&quot;https://bjoli.com/images/04_unit_integration_tests.png&quot; width=&quot;512&quot; height=&quot;384&quot;&gt;&lt;/p&gt;
  &lt;h3 id=&quot;terminology&quot;&gt;Terminology&lt;/h3&gt;
  &lt;h3 id=&quot;unit-tests&quot;&gt;Unit Tests&lt;/h3&gt;
    &lt;p&gt;These are tests that should be scoped relatively small, and rely on mocking any external
       service that makes a network call or IO of any kind. This allows these tests to be run
       after every commit (or after every change!) and ensure that the feedback loop is very
       tight. Even running a linter would be a small start, but code you write to validate your
       production code does what it should would be best.&lt;/p&gt;
  &lt;h3 id=&quot;integration-tests&quot;&gt;Integration Tests&lt;/h3&gt;
    &lt;p&gt;These are the larger, less frequently run tests. This would be part of a frequent release
       process, something that wasn&#39;t so frequent that it was expected to be run by developers
       multiple times per day, but not so infrequently that things change out from underneath it
       too frequently. This is something that could actually spin up dev instances of whatever
       services are necessary, and run through a battery of expected user behavior.&lt;/p&gt;
  &lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
     &lt;p&gt;Between small and fast &quot;unit tests&quot; and larger, more comprehensive &quot;integration tests&quot;
        I have found that it enables teams to move more quickly and with confidence, even if those
        engineers are just dropping in with a quick bug fix. Comments and suggestions appreciated-
        feel free to &lt;a href=&quot;https://twitter.com/Yasumoto&quot;&gt;mention me on Twitter!&lt;/a&gt;
&lt;/p&gt;&lt;/div&gt;
</content>
  </entry>
</feed>