<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>CyberFOX Software Inc. &#187; testing</title>
	<atom:link href="http://cyberfox.com/blog/category/testing/feed" rel="self" type="application/rss+xml" />
	<link>http://cyberfox.com/blog</link>
	<description>Coding, Connections, and Other Bloggy Bits of Goodness</description>
	<lastBuildDate>Sat, 25 Jul 2009 21:27:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Approaching an inherited Rails codebase</title>
		<link>http://cyberfox.com/blog/2009/05/21/56/approaching-an-inherited-rails-codebase</link>
		<comments>http://cyberfox.com/blog/2009/05/21/56/approaching-an-inherited-rails-codebase#comments</comments>
		<pubDate>Fri, 22 May 2009 06:20:29 +0000</pubDate>
		<dc:creator>Cyberfox</dc:creator>
				<category><![CDATA[Ruby]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[work]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[rails]]></category>

		<guid isPermaLink="false">http://www.cyberfox.com/blog/?p=56</guid>
		<description><![CDATA[Greetings,
[Edit: Since writing this article up back in early March, I've moved on from this job. The folks who are now maintaining it at least know where the pain points are, can run migrations safely, deploy it locally, and to dev servers, and to the main deployment area.  It's a working app, although I never [...]]]></description>
			<content:encoded><![CDATA[<p>Greetings,</p>
<p><small><em>[Edit: Since writing this article up back in early March, I've moved on from this job. The folks who are now maintaining it at least know where the pain points are, can run migrations safely, deploy it locally, and to dev servers, and to the main deployment area.  It's a working app, although I never got code coverage above about 45% at least the coverage was decent in the core app areas by the time I left.]</em></small></p>
<p><a title="A Fresh Cup" href="http://afreshcup.com/">Mike Gunderloy</a> had an interesting article entitled &#8216;<a href="http://afreshcup.com/2009/03/23/batting-clean-up/">Batting Clean-up</a>&#8216;, which was very timely for me.  I’ve just started maintaining and trying to improve a Rails app developed by an ‘outsourced’ group. The only tests were the ones generated automatically by ‘restful authentication’, and they were never maintained, so they didn’t come close to passing. Swaths of the program are written in terribly complex (and sometimes computed) SQL, migrations didn’t bring up a fresh database (poor use of acts_as_enumerated causes great hurt), and vendor/plugins should have just had one named ‘kitchen_sink’.</p>
<p>It hurts to see Rails abused like that; you want to take the poor application under your arm and say, ‘It’ll be okay…we’ll add some tests and get you right as rain in no time!’, but you know you’d be lying…</p>
<p>I did much of what Mike <a title="Batting Clean-Up" href="http://afreshcup.com/2009/03/23/batting-clean-up/">described</a> (half the gems it used were config.gem’ed, the other half weren’t), vendor’ed rails (it breaks on newer than 2.1.0), and brought the development database kicking and screaming into life. There was no schema.rb, it had been .gitignore’d, and the migrations added data, used models, and everything else you can imagine doing wrong. (Including using a field on a model after adding that column in the previous line…I don’t know what version of Rails that ever worked on…) I didn’t want a production database; who knows what’s been done to that by hand. I want to know what the database is _supposed_ to look like; I can figure out the difference with production later.</p>
<p>Once the clean (only data inserted by migrations) dev database was up, I brought the site up to see if it worked. Surprisingly enough, it did; apparently they used manual QA as their only testing methodology. I appreciate their QA a lot; it means it’s a working application, even if it’s not going to help me refactor it.</p>
<p>I ran <a title="Flog (grotesque art, great tool)" href="http://ruby.sadi.st/Flog.html">flog</a> and <a href="http://ruby.sadi.st/Flay.html">flay</a> and looked at the pain points they found to get an idea how bad things might be. I picked an innocuous join table (with some extra data and functionality) to build the first set of tests for, which gave me insight into both sides of the join without having to REALLY dig into the ball of fur on either side. I viciously stripped all the ‘test_truth’ tests. I looked for large files that flog and flay hadn’t picked up to pore over. Check out custom rake tasks, because those often are clear stories and easy to quickly understand in a small context.</p>
<p>Checking out the deployment process tells you a lot also, although it turns out this was stock engine yard capistrano.</p>
<p>Skimming views (sort by size!) will tell you a lot also, especially when you find SQL queries being run in them…</p>
<p>Use the site for a little while, and watch the log in another window. Just let it skim by; if you’ve looked at log files much, things that seem wrong will jump out even if it’s going faster than you can really read.</p>
<p>In my case, the code’s mine now, so it’s my responsibility to make it better before anybody else has to touch it. I’ve got about a week of ‘free fix-it-up time’ before I need to start actually implementing new features and (thankfully) stripping out old ones… At my previous company, I was the guy pushing folks to test, now I’ve inherited a codebase with zero tests. Poetic justice, I suppose&#8230; <img src='http://cyberfox.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Good luck!</p>
<p>—  Morgan Schweers, Cyber<strong>FOX</strong>!</p>
]]></content:encoded>
			<wfw:commentRss>http://cyberfox.com/blog/2009/05/21/56/approaching-an-inherited-rails-codebase/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TDD: The &#8216;Logans Run&#8217; of Software Development&#8230;</title>
		<link>http://cyberfox.com/blog/2007/10/05/35/tdd-the-logans-run-of-software-development</link>
		<comments>http://cyberfox.com/blog/2007/10/05/35/tdd-the-logans-run-of-software-development#comments</comments>
		<pubDate>Sat, 06 Oct 2007 03:09:23 +0000</pubDate>
		<dc:creator>Cyberfox</dc:creator>
				<category><![CDATA[BDD]]></category>
		<category><![CDATA[TDD]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[work]]></category>

		<guid isPermaLink="false">http://www.vixen.com/blog/2007/10/05/35</guid>
		<description><![CDATA[Greetings,
I want to start by making it clear that I know why testing is good, and that it&#8217;s really important, but I think that the TDD proponents are glossing over the most difficult part of a project.
I would very much like someone to address the issue of modifying code that is not new, and not [...]]]></description>
			<content:encoded><![CDATA[<p>Greetings,</p>
<p>I want to start by making it clear that I know <strong>why</strong> testing is good, and that it&#8217;s <em>really</em> important, but I think that the TDD proponents are glossing over the most difficult part of a project.</p>
<p>I would very much like someone to address the issue of modifying code that is <strong>not new</strong>, and <strong>not already perfectly tested</strong> (or even completely specified!).  That is to say, the vast majority of actual code out there.</p>
<p>TDD <em>is</em> intensely focused on the early development phase (or at least TDD proponents are), and on writing <em>new</em> code, as opposed to what the majority of software developers actually do; maintain and update existing code.</p>
<p>It&#8217;s really straightforward (and fun!) to write entirely new code in the TDD fashion.  I&#8217;ve done it for about 3 decent sized projects now (one Java and two Rails), and it can be really pleasant, and a great focusing tool.  No arguments there; when you do it from the start, it&#8217;s really wonderful.</p>
<p>On the other hand, when you&#8217;re making incremental changes here and there throughout a very large, pre-existing, only partially tested codebase, it&#8217;s vastly less pleasant to try and do it test-first.</p>
<p>The Ruby Autotest tool is not such a pleasant tool at that point.  You stop wanting to write failing tests, because fixing it means autotest is going to try to do a <em>full retest</em>, which <strong>sucks</strong> for developer flow&#8230;  Even if your tests take &#8216;only&#8217; 5 minutes to run, breaking a test makes you wince, and writing a failing test and then fixing it is for masochists only (and ones who want to miss the project milestones at that).</p>
<p>The focus of <em>every</em> presentation (<a title="How I learned to love testing..." href="http://www.railsenvy.com/2007/10/4/how-i-learned-to-love-testing-presentation">this one</a> included) I&#8217;ve seen on TDD being on the <em>start</em> of a project makes me wonder why nobody&#8217;s talking about later in projects&#8230;</p>
<p>Nearly every developer out there is going to face a large codebase with poor testing coverage, and will have to make changes that aren&#8217;t entirely new code, to existing code that isn&#8217;t entirely tested.  Does TDD have a solution for the &#8216;large, crufty codebase&#8217;, or is it suited only for 1.0 versions, small projects, and projects that were TDD from the start?</p>
<p>This isn&#8217;t really a rhetorical question for me.  I <em>really</em> want to get my organization&#8217;s culture more oriented towards testing.  I&#8217;ve got buy-in from lots of people that when they&#8217;re writing new modules and services, they&#8217;ll do it test-first (or at least &#8216;test around the same time as the code&#8217;, which is all I can ask for at this point), and that&#8217;s great.  But has anybody developed <strong>any</strong> tools to make TDD better suited to <em>maintenance</em> and improving existing code?</p>
<p>&#8211;  Morgan</p>
<p>p.s.  I&#8217;m skipping BDD entirely, because BDD is so hardcore in the &#8216;only for already very well specified solutions&#8217; camp, that it&#8217;s meaningless for this question.  I&#8217;m also using &#8216;TDD&#8217; and &#8216;test-first&#8217; interchangeably, and I probably shouldn&#8217;t be.</p>
<p>p.p.s.  The title refers to how in Logans Run, everybody was destroyed at 30, so there weren&#8217;t any old people. In the world of TDD (or at least TDD presentations), there are no old projects, every one is fresh and new, so the issues that come with an old code base are never addressed.</p>
]]></content:encoded>
			<wfw:commentRss>http://cyberfox.com/blog/2007/10/05/35/tdd-the-logans-run-of-software-development/feed</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>
