Tesly Jr. Now Open Source

7 Jun 2007

A while ago I launched Tesly Jr. as a free hosted service for producing HTML reports for your automated Rails tests. A week or so before RailsConf I decided to open up the source to this simple little app, so now you can host your own version of Tesly Jr. Head on over to the Tesly Jr. site and download it from the link on the right-hand side of the page. Enjoy!



Finding bugs with irb

2 Jan 2007

There has been a lot of irb love happening lately, and I’m lovin’ the irb, too.

After launching a Rails e-commerce application recently, I was taking a look through the database just to make sure things were working as expected. Lo and behold, I found a problem. Something funky was happening with a small number of the orders. Time to dig in.

The problem centered around calculating discounts, which calculations can be affected by a number of variables present at the time of checkout: the particular items in the cart, the discount code used, etc. In other words, it would be somewhat difficult to work out what should have happened versus what actually happened by taking the relevant data and doing the calculations by hand. In this case, it would be much easier to actually poke at the transactions in question and play with the code as it would have interacted at the time of the transaction. Rails console to the rescue!

$ ./script/console
  >> irb Sale.find(:first, :conditions => "something’s not quite right")
  >>

What’s that you say? Invoking irb from inside irb? Madness! What does it do? It loads another session inside your current session, and now self points to the results of that Sale.find. Why is this so useful? Well, suppose you have an instance method in the Sale class that does a lot of calculations, pulling in the related discount, related line items, etc., and it has references to self.this and self.that all over the place in there. With a little help from this irb sub-session, now you can play with that code as it was written, and (in this case) as it was executed against the instance when the instance was first created.

So, with this powerful tool in hand, and a little time poking at the discount calculations, I found my problem, wrote a test that reproduced it, fixed it, and repaired the affected transactions. Yay irb!



Test Case Results for Tesly Jr.

19 Oct 2006

I just pushed out a minor update Tesly Jr. that improves the navigation of test run results. Now instead of linking back to the test plan when viewing the details of a test run, the links take you to run-specific information for that test plan. In other words, you can now drill down to the result for each test case for all of your test run history.



Tesly Jr. Gets Email

11 Oct 2006

As requested on the Ruby Talk mailing list, you can now receive emails for failing test cases from Tesly Jr. If you specify on the Profile page that you’d like to receive email notifications, you will receive an email any time a test run includes a test plan that has a failing test case.

Now there is no excuse to not use Tesly Jr. for your continuous integration! :)



Tesly Jr. Launched

5 Oct 2006

Tesly Jr. is an HTML test reporter for automated test frameworks. The first environment to be supported is Ruby’s Test::Unit, complete with a plugin for Ruby on Rails. This Rails plugin can be dropped in to a Rails project to easily add automated reporting to Tesly Jr.

What does this do for you? Well, it provides a pretty GUI interface to your test results. :) It also provides an RSS feed that is updated with the pass percentage of your tests every time you run them. In that way, it’s a good fit for continuous integration systems. Finally, once your test plans and test cases have been created by running your tests (via Rake, as usual, for Rails developers), you can add descriptions to the test plans and test cases to help document what you are testing and why.

Now you can brag to your friends about how many tests you have in your app, or show your clients and customers that you actually have tests. :)

I’d like to support other testing frameworks, like jUnit, etc. To that end, the reporting interface is simple HTTP, so any testing framework that allows for a custom reporter and can send HTTP POST requests can send test result reports to Tesly Jr. I’ll put up some info about how to construct that request at the site eventually, but until then you can contact me for info about how to do it. I’ll be happy to get more frameworks supported by helping you build hooks for your favorite one.