<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>@Lathi.net: No Steps to Faster Testing</title>
    <link>http://blog.lathi.net/articles/2005/10/09/no-steps-to-faster-testing</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>On Life, Fatherhood, Christianity, and Computers</description>
    <item>
      <title>No Steps to Faster Testing</title>
      <description>&lt;p&gt;I was actually hoping to title this blog post &amp;#8220;Five Easy Steps to Faster Testing.&amp;#8221;  Unfortunately not.  Here&amp;#8217;s why I&amp;#8217;m complaining about testing performance:&lt;/p&gt;


&lt;code&gt;&lt;pre&gt;
$ time rake
blah blah blah blah blah
Started
.................
Finished in 81.306421 seconds.

115 tests, 353 assertions, 0 failures, 0 errors
blah blah blah blah blah blah
Started
.......................
Finished in 85.885546 seconds.

89 tests, 703 assertions, 0 failures, 0 errors

real    3m5.970s
user    1m48.390s
sys     0m8.410s
&lt;/pre&gt;&lt;/code&gt;

	&lt;p&gt;Ugh.  It get&amp;#8217;s really, really annoying to have to do that a few times in an evening.&lt;/p&gt;


	&lt;p&gt;So, I had heard that &lt;a href="http://www.sqlite.org/"&gt;SQLite&lt;/a&gt; was really, really fast.  I thought that most of my bottle neck in testing is loading and unloading the database.  I&amp;#8217;m still using MySQL with old MyISAM files; so not transactions for me.  The directions on &lt;a href="http://wiki.rubyonrails.com/rails/pages/HowtoUseSQLite"&gt;How to use SQLite in Ruby on Rails&lt;/a&gt; seemed so clear, I was sure I could get it working in no time.&lt;/p&gt;


	&lt;p&gt;My plan was to leave MySQL as my development and production databases, but switch to SQLite for testing.  The first problem turned out to be what I&amp;#8217;m calling a bug in &lt;a href="http://darwinports.opendarwin.org/"&gt;DarwinPorts&lt;/a&gt; portfile for SQLite.  It appears that &lt;a href="http://www.swig.org/"&gt;swig&lt;/a&gt; must be installed before you install SQLite, but it&amp;#8217;s not a dependency.  So, install swig via ports, sqlite3 via ports, and sqlite3-ruby via gems.  OK, I&amp;#8217;m working.&lt;/p&gt;


	&lt;p&gt;Second problem: rake wants to just dump the structure from development and then load that into testing.  But the schema from MySQL isn&amp;#8217;t compatible with SQLite.  OK, I modify the Rakefile to not do that.&lt;/p&gt;


	&lt;p&gt;So now I&amp;#8217;m running my tests.  Keep in mind all my tests pass with MySQL.  The first thing I note is that my tests don&amp;#8217;t seem to be running that much faster.  Then I see a test fail.  Then things get really slow; no wait, it&amp;#8217;s hung.  The thing is I have no idea why my test failed and then another one hung.  By this point I had sunk more time into it than I had to spare.  I decided to punt.&lt;/p&gt;


	&lt;p&gt;I don&amp;#8217;t mean to trash-talk SQLite.  I&amp;#8217;m sure it&amp;#8217;s a marvelous database and I&amp;#8217;m the screwup for not being able to get it to work smoothly.  But, I did loose probably four or five hours to this experiment.  I had to write something to account for my time.&lt;/p&gt;</description>
      <pubDate>Sun, 09 Oct 2005 22:30:48 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:9e4fd66a080b4500cd1eee70a957cb6d</guid>
      <author>Doug</author>
      <link>http://blog.lathi.net/articles/2005/10/09/no-steps-to-faster-testing</link>
      <category>Test Driven Development</category>
      <category>Ruby on Rails</category>
      <category>testing</category>
      <category>SQLite</category>
      <category>Rails</category>
    </item>
    <item>
      <title>"No Steps to Faster Testing" by Doug</title>
      <description>&lt;p&gt;I&amp;#8217;ve heard the rake target to dump the scheme is fixed in &amp;#8220;edge rails&amp;#8221; to be db agnostic.  That would certainly make this whole process a lot easier.&lt;/p&gt;


	&lt;p&gt;of course, that still leaves with why my tests were failing.  Also, any &lt;code&gt;find_by_sql&lt;/code&gt; statements would have to be scrubbed of db specfic SQL.&lt;/p&gt;</description>
      <pubDate>Wed, 12 Oct 2005 15:43:04 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1807bfeb-10c4-4369-b78b-eb77f4de5c71</guid>
      <link>http://blog.lathi.net/articles/2005/10/09/no-steps-to-faster-testing#comment-68</link>
    </item>
  </channel>
</rss>

