Rails Resource Feeder Fun

27 Sep 2006

I had my first chance to use the new resource feeder yesterday while working on Tesly Jr. (yet to be announced product — contact me to learn more if you’re interested), and I thought I’d write up a quick example of how it’s used. The disclaimer to this post is that the resource feeder plugin is still quite new, and this example could become obsolete at any time.

There’s already a blog post about using this plugin, but I wanted to show something else — an answer to a question I’m sure will pop up again and again in #rubyonrails when people start really using this plugin: how do you customize the contents of the feed with multiple attributes from the model? It’s as simple as passing a proc in to the feeder:

class TestRunsController < ApplicationController
  def feed
    render_atom_feed_for TestRun.find(:all, :include => :test_plans, :order => ‘test_runs.created_at desc’, :limit => 50),
      :item => {
        :title => ‘Test run execution’,
        :description => Proc.new {|r| "Executed test plans: #{r.test_plan_names}

\n\nPass percentage: #{r.percentage.round}%"
}
      }
  end
end


Automated Test Case Reporting

28 Aug 2006

Over the weekend I added a feature to Tesly to allow the results of test cases to be reported via an API. Of course, the first testing environment to be supported is Rails (Test::Unit). :)

By installing the Tesly Reporter plugin, Rails developers can have the results of their automated tests be reported to Tesly so that other developers, managers, and clients on their projects can see at a glance what is being tested and what the latest results of those tests are. I also used the CSS progress bars from Tobi to make it extremely easy to see the health of the project according to the test results.

After creating a Tesly account (Personal plan or better) and installing and configuring the plugin, you can run your tests as usual (rake, rake test:units, etc.). After each test run, the results will be sent to Tesly and recorded in the database. Each test file becomes a test plan, and each test method becomes a test case. The project, test plans, and test cases will all be created on the fly if neccessary, or updated if not. You can then change the names of the test plans and test cases and the automated reporting will still work.

I’ve been looking forward to having this feature for a while now, and I’m excited to be able to use it. I hope you will take it for a spin.