Automated testing with Ruby on Rails - best practices

Curious, what are you folks doing in as far as automating your unit tests with ruby on rails? Do you create a script that run a rake job in cron and have it mail you results? a pre-commit hook in git? just manual invokation? I understand tests completely, but wondering what are best practices to catch errors before they happen. Let's take for granted that the tests themselves are flawless and work as they should. What's the next step to make sure they reach you with the potentially detrimental results at the right time?

Answers


Not sure about what exactly do you want to hear, but there are couple of levels of automated codebase control:

  1. While working on a feature, you can use something like autotest to get an instant feedback on what's working and what's not.

  2. To make sure that your commits really don't break anything use continuous integration server like cruisecontrolrb or Integrity (you can bind these to post-commit hooks in your SCM system).

  3. Use some kind of exception notification system to catch all the unexpected errors that might pop up in production.

  4. To get some more general view of what happened (what was user doing when the exception occured) you can use something like Rackamole.

Hope that helps.


If you are developing with a team, the best practice is to set up a continuous integration server. To start, you can run this on any developers machine. But in general its nice to have a dedicated box so that its always up, is fast, and doesn't disturb a developer. You can usually start out with someone's old desktop, but at some point you may want it to be one of the faster machines so that you get immediate response from tests.

I've used cruise control, bamboo and teamcity and they all work fine. In general the less you pay, the more time you'll spend setting it up. I got lucky and did a full bamboo set up in less than an hour (once)-- expect to spend at least a couple hours the first time through.

Most of these tools will notify you in some way. The baseline is an email, but many offer IM, IRC, RSS, SMS (among others).


Need Your Help

Knockout missing error

c# asp.net-mvc asp.net-mvc-4 razor knockout.js

I follow this tutorial: http://knockoutmvc.com/GiftList to create ediable list.