<?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>Nick Sieger: Tag autotest</title>
    <link>http://blog.nicksieger.com/articles/tag/autotest?tag=autotest</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Auto RSpec</title>
      <description>&lt;p&gt;&lt;em&gt;Update: (2 months later) If you&amp;#8217;re reading this, you&amp;#8217;re probably interested in &lt;a href="/articles/2006/11/15/rspec-autotest-now-a-rails-plugin"&gt;my Rails plugin for this&lt;/a&gt; instead.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Hot off the presses, after a few hours of hacking and tweaking, may I present Auto+RSpec, otherwise known as The Mashup of &lt;a href="http://rspec.rubyforge.org/tools/rails.html"&gt;RSpec on Rails&lt;/a&gt; and &lt;a href="http://www.zenspider.com/ZSS/Products/ZenTest/"&gt;autotest&lt;/a&gt;.  This is not an official release of any sort, but &amp;#8220;may work for you.&amp;#8221;  It&amp;#8217;s not a clean hack, as it exposes some areas for autotest to grow if the maintainers decide to open it up to alternatives to Test::Unit.  After spending a little time looking at the autotest code, I think it would be nice to allow hooks for autotest plugins to define project conventions (i.e., &lt;code&gt;@exceptions&lt;/code&gt; and the &lt;code&gt;#tests_for_file&lt;/code&gt; method) as well as a result parsing API.&lt;/p&gt;

&lt;p&gt;For now, if you&amp;#8217;re an RSpec on Rails user, you can try this out as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install &lt;a href="http://www.zenspider.com/ZSS/Products/ZenTest/"&gt;ZenTest&lt;/a&gt; if you haven&amp;#8217;t already: &lt;code&gt;sudo gem install ZenTest&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://svn.caldersphere.net/svn/main/rspec_autotest/trunk/lib/rspec_autotest.rb"&gt;rspec_autotest.rb&lt;/a&gt; and put in your &lt;code&gt;vendor/plugins/rspec/lib&lt;/code&gt; directory (you did say you&amp;#8217;re using RSpec on Rails didn&amp;#8217;t you?)&lt;/li&gt;
&lt;li&gt;Download &lt;a href="http://svn.caldersphere.net/svn/main/rspec_autotest/trunk/tasks/rspec_autotest.rake"&gt;rspec_autotest.rake&lt;/a&gt; and put in your &lt;code&gt;lib/tasks&lt;/code&gt; directory&lt;/li&gt;
&lt;li&gt;Start &lt;code&gt;autotest&lt;/code&gt; with rake by typing &lt;code&gt;rake spec:autotest&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;Note: if you&amp;#8217;re using RSpec 0.6, you might have better success with &lt;a href="http://svn.caldersphere.net/svn/main/rspec_autotest/tags/rspec-0.6.0"&gt;the files located here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Next steps for this will be to work out whether this code should live in RSpec on Rails or autotest, or some combination of those.&lt;/p&gt;

&lt;p&gt;Now, spec&amp;#8217;ers, be off in search of that &lt;strong&gt;Red/Green/Refactor&lt;/strong&gt; rhythm of which sage agilists speak!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Bonus tip&lt;/strong&gt;: add the following code to your &lt;code&gt;.autotest&lt;/code&gt; file to run &lt;code&gt;spec&lt;/code&gt; with &lt;code&gt;rcov&lt;/code&gt;:&lt;/p&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;  &lt;span class="constant"&gt;Autotest&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;add_hook&lt;/span&gt; &lt;span class="symbol"&gt;:initialize&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt; &lt;span class="punct"&gt;|&lt;/span&gt;&lt;span class="ident"&gt;at&lt;/span&gt;&lt;span class="punct"&gt;|&lt;/span&gt;
    &lt;span class="comment"&gt;# run spec with rcov&lt;/span&gt;
    &lt;span class="keyword"&gt;if&lt;/span&gt; &lt;span class="ident"&gt;at&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;respond_to?&lt;/span&gt; &lt;span class="symbol"&gt;:spec_command&lt;/span&gt;
      &lt;span class="ident"&gt;at&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;spec_command&lt;/span&gt; &lt;span class="punct"&gt;=&lt;/span&gt; &lt;span class="punct"&gt;%{&lt;/span&gt;&lt;span class="string"&gt;rcov --exclude &amp;quot;lib/spec/.*&amp;quot; -Ilib --rails &amp;quot;/usr/lib/ruby/gems/1.8/gems/rspec-0.6.0/bin/spec&amp;quot; -- --diff&lt;/span&gt;&lt;span class="punct"&gt;}&lt;/span&gt;
    &lt;span class="keyword"&gt;end&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <pubDate>Wed, 13 Sep 2006 20:35:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:52bf2e58-ea0e-4473-bad5-c7b42775bfee</guid>
      <author>Nick Sieger</author>
      <link>http://blog.nicksieger.com/articles/2006/09/13/auto-rspec</link>
      <category>testing</category>
      <category>ruby</category>
      <category>rails</category>
      <category>ruby</category>
      <category>autotest</category>
      <category>rspec</category>
      <category>testing</category>
      <trackback:ping>http://blog.nicksieger.com/articles/trackback/59</trackback:ping>
    </item>
    <item>
      <title>RSpec Autotest for Standalone Projects</title>
      <description>&lt;p&gt;I know there has been some demand out there for a version of my &lt;a href="/articles/2006/11/15/rspec-autotest-now-a-rails-plugin"&gt;RSpec Autotest Rails plugin&lt;/a&gt; that works with standalone (non-Rails) projects, so I finally caved and coded it up.  I really hope this does finally get accepted as &lt;a href="https://rubyforge.org/tracker/?func=detail&amp;amp;aid=6732&amp;amp;group_id=419&amp;amp;atid=1680"&gt;a patch to ZenTest&lt;/a&gt; (nudge, nudge), but until it gets a more standard release, do try it out:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Ensure you have ZenTest installed (&lt;code&gt;gem install ZenTest&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;&lt;a href="http://svn.caldersphere.net/svn/main/rspec_autotest/trunk/lib/rspec_autotest.rb"&gt;Download the rspec_autotest.rb file here&lt;/a&gt; and put it in the &lt;code&gt;spec&lt;/code&gt; directory of your project.&lt;/li&gt;
&lt;li&gt;Add this snippet of code into your &lt;code&gt;Rakefile&lt;/code&gt;, and &lt;code&gt;rake spec:autotest&lt;/code&gt; as usual.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_ruby "&gt;&lt;span class="ident"&gt;namespace&lt;/span&gt; &lt;span class="symbol"&gt;:spec&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
  &lt;span class="ident"&gt;task&lt;/span&gt; &lt;span class="symbol"&gt;:autotest&lt;/span&gt; &lt;span class="keyword"&gt;do&lt;/span&gt;
    &lt;span class="ident"&gt;require&lt;/span&gt; &lt;span class="punct"&gt;'&lt;/span&gt;&lt;span class="string"&gt;./spec/rspec_autotest&lt;/span&gt;&lt;span class="punct"&gt;'&lt;/span&gt;
    &lt;span class="constant"&gt;RspecAutotest&lt;/span&gt;&lt;span class="punct"&gt;.&lt;/span&gt;&lt;span class="ident"&gt;run&lt;/span&gt;
  &lt;span class="keyword"&gt;end&lt;/span&gt;
&lt;span class="keyword"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Once again, happy spec&amp;#8217;ing, and let me know of any issues you have with it.&lt;/p&gt;</description>
      <pubDate>Tue, 30 Jan 2007 02:16:00 +0000</pubDate>
      <guid isPermaLink="false">urn:uuid:ea568e8e-e6f4-4fb7-80df-8da5f50065b9</guid>
      <author>Nick Sieger</author>
      <link>http://blog.nicksieger.com/articles/2007/01/30/rspec-autotest-for-standalone-projects</link>
      <category>ruby</category>
      <category>rspec</category>
      <category>autotest</category>
      <trackback:ping>http://blog.nicksieger.com/articles/trackback/204</trackback:ping>
    </item>
  </channel>
</rss>
