Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 649
randombits Avatar asked Apr 08 '10 00:04

randombits


1 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.

like image 115
Milan Novota Avatar answered Sep 30 '22 19:09

Milan Novota