Continuous integration with Rails, Jenkins and CI_Reporter

The ci_reporter gem is an add-on to TestUnit and RSpec that allows for smooth integration with any continuous integration (CI) tool that understands JUnit automated test results. Jenkins is a popular continuous integration server that can report on JUnit results, and it’s what we’ve used to accomplish CI with full featured automated testing on one of our latest Ruby on Rails projects.

Jenkins's test results graph

For our project, we utilized ci_reporter’s TestUnit integration to get Jenkins to read test results, and report back on them after project builds completed. The results of the tests are reported and logged in Jenkins, which displays a results graph so you can visually track test results across a project’s build history.

 

Jenkins also has a jabber plugin that connects to a project conference room to report back results when a build is completed. What this meant for our project is that once a commit was pushed to our integration branch, Jenkins would:

  • trigger a rebuild of the integration server through a build script
  • run all automated tests
  • report the commits included in the last build, the build status (Success or Failure)
  • report any failed automated tests to the project chat room

Combined with a gitflow-style branching strategy, the functionality of Jenkins augmented with ci_reporter for test results allows very fast turnaround of issues. By keeping all interested parties in the loop when it comes to the current state of the project’s codebase, the results of the projects automated tests, and what issues are ready to be tested, back and forth during testing was essentially eliminated.

For details on setting up your Rails (or Ruby) application to make use of ci_reporter, have a look at the project documentation on github, which also includes the required configuration details for Jenkins.

  • Josh

    The jabber plugin is particularly useful for notifying QA that a feature is deployed and testable.