Riot: for fast, expressive and focused unit tests

JustinRiot is a new Ruby test framework by Justin Knowlden that focuses on faster testing. Justin was frustrated with his slow running test suites, despite employing techniques such as using factories, mocks and avoiding database access. He realized that a slow-running suite makes one reluctant to run it or expand it – not good.

With Riot, each test consists of a block which forms a single assertion on the topic of the test, keeping the tests focused. Tests run in a specific context, and the setup code is only run once per context, further contributing to the speed of your test suite, and unlike some Ruby test frameworks, such as Shoulda, that rely on or are based on Test::Unit, Riot has taken a new approach for speed purposes. In Justin’s own comparisons, Riot comes out about twice as fast as Test::Unit.

Here’s an example Riot test (from the README):

context "a new user" do
  setup { User.new(:email => 'foo@bar.com') }
  asserts("email address") { topic.email }.equals('foo@bar.com')
end

Riot’s comprehensive README also includes lots of examples and details on how to modify your Rakefile to run your Riot test suite in different frameworks. The full documentation is available online here.

You can install Riot as a gem from Gemcutter:

sudo gem sources -a http://gemcutter.org
sudo gem install riot

Justin also has a spin-off project called Riot Rails, which includes some Rails-related macros for testing your Ruby On Rails code, and Alex Young has written a Javascript port of Riot which is worth checking out too. He also has his own look at Riot and demonstrates how Riot can reduce redundancy in tests.

CodebaseLogo-RI.png[ad] Codebase is a fast & reliable git, mercurial & subversion hosting service with complete project management built-in – ticketing, milestones, wikis & time tracking – all under one roof. Click here to try it – free.

Planet Argon Podcast, Episode 2: The Letter Scotch

Earlier this week our new podcast was approved and is now available in the Apple iTunes Store. We’re also soliciting topic ideas for future episodes on brainstormr.

We posted Episode 2, The Letter Scotch, yesterday for your enjoyment. In this episode, we covered a handful of web browser tools that we use (and detest) to debug <span class="caps">HTML</span>, CSS, and JavaScript. This included Web Inspector, Firebug, DebugBar, and a handful of other tools. We all have slightly different preferences, depending on the tasks that we&#8217;re working on and the team had an open dialogue about the pros/cons of each of these tools.


You can learn more about and listen to our podcast at <a href="http://planetargon.com/podcast">http://planetargon.com/podcast</a>.


<p>Thanks in advance for listening!</p><div class="feedflare">