Will Sargent
2008-Jan-13 22:59 UTC
Options for a continuous integration environment with RoR?
Hi all, I''m in the process of setting up cruisecontrolrb with RCov as our continuous integration server. We use rSpec for our unit tests, and AFAIK all the integration tests and system tests are done offline (i.e. scripted but not automated). I''ve heard that many people use Cerberus or "straight" CruiseControl with Ruby. Is there a consensus over which one is better, if any? And how do people automate their system and integration tests in Rails? Is there a standard way to do this? Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Edward
2008-Jan-14 03:27 UTC
Re: Options for a continuous integration environment with RoR?
Hi Will, I can''t speak to server-oriented tools like CC, but you might want to check out ZenTest [1] for continuous testing on your own development machine. It has a tool called "autotest" that will run in the background and re-run your tests every time you save a file. I believe all you have to do is a: `sudo gem install ZenTest` and then cd to the root directory of your rails project and type "autotest". ted [1] http://www.zenspider.com/ZSS/Products/ZenTest/ On Jan 13, 5:59 pm, "Will Sargent" <will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi all, > > I''m in the process of setting up cruisecontrolrb with RCov as our > continuous integration server. We use rSpec for our unit tests, and > AFAIK all the integration tests and system tests are done offline > (i.e. scripted but not automated). > > I''ve heard that many people use Cerberus or "straight" CruiseControl > with Ruby. Is there a consensus over which one is better, if any? > And how do people automate their system and integration tests in > Rails? Is there a standard way to do this? > > Will.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-14 03:36 UTC
Re: Options for a continuous integration environment with RoR?
I recommend using cruisecontrol. It should be fairly easy to set up and will run all of your tests every time you commit a file. It has the added option (a plugin, perhaps?) of sending a message through jabber to somebody, or a list of somebodies, or even an email. Autotest is good for your own box, but when cruisecontrol sends out insults humiliating a team member because they committed a broken build, it gives them the incentive not to do it again! On Jan 14, 2008 1:57 PM, Edward <edward.benson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hi Will, > > I can''t speak to server-oriented tools like CC, but you might want to > check out ZenTest [1] for continuous testing on your own development > machine. It has a tool called "autotest" that will run in the > background and re-run your tests every time you save a file. > > I believe all you have to do is a: `sudo gem install ZenTest` and then > cd to the root directory of your rails project and type "autotest". > > ted > > [1] http://www.zenspider.com/ZSS/Products/ZenTest/ > > On Jan 13, 5:59pm, "Will Sargent" <will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi all, > > > > I''m in the process of setting up cruisecontrolrb with RCov as our > > continuous integration server. We use rSpec for our unit tests, and > > AFAIK all the integration tests and system tests are done offline > > (i.e. scripted but not automated). > > > > I''ve heard that many people use Cerberus or "straight" CruiseControl > > with Ruby. Is there a consensus over which one is better, if any? > > And how do people automate their system and integration tests in > > Rails? Is there a standard way to do this? > > > > Will. > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung
2008-Jan-14 07:07 UTC
Re: Options for a continuous integration environment with RoR?
On 14 Jan 2008, at 03:36, Ryan Bigg wrote:> I recommend using cruisecontrol. It should be fairly easy to set up > and will run all of your tests every time you commit a file. It has > the added option (a plugin, perhaps?) of sending a message through > jabber to somebody, or a list of somebodies, or even an email. > > Autotest is good for your own box, but when cruisecontrol sends out > insults humiliating a team member because they committed a broken > build, it gives them the incentive not to do it again! >We''ve been using cruisecontrol.rb for a little while now and it''s great. We''ve added a little tweak so that it fires on a subversion post-commit hook rather than polling and everytime a build is broken it emails us. Fred> On Jan 14, 2008 1:57 PM, Edward <edward.benson-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi Will, > > I can''t speak to server-oriented tools like CC, but you might want to > check out ZenTest [1] for continuous testing on your own development > machine. It has a tool called "autotest" that will run in the > background and re-run your tests every time you save a file. > > I believe all you have to do is a: `sudo gem install ZenTest` and then > cd to the root directory of your rails project and type "autotest". > > ted > > [1] http://www.zenspider.com/ZSS/Products/ZenTest/ > > On Jan 13, 5:59pm, "Will Sargent" < will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi all, > > > > I''m in the process of setting up cruisecontrolrb with RCov as our > > continuous integration server. We use rSpec for our unit tests, and > > AFAIK all the integration tests and system tests are done offline > > (i.e. scripted but not automated). > > > > I''ve heard that many people use Cerberus or "straight" CruiseControl > > with Ruby. Is there a consensus over which one is better, if any? > > And how do people automate their system and integration tests in > > Rails? Is there a standard way to do this? > > > > Will. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thibaut Barrère
2008-Jan-14 08:03 UTC
Re: Options for a continuous integration environment with RoR?
I''m using CruiseControl.rb as well for all my Rails apps and also for pure Ruby apps (including a datawarehouse project), and I''m also using Rspec like you. I''ve had small issues setting up growl notifications, but that''s all ! cheers Thibaut -- http://blog.logeek.fr - about writing software http://evolvingworker.com - tools for a better day --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-14 18:44 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2008 12:03 AM, Thibaut Barrère <thibaut.barrere-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m using CruiseControl.rb as well for all my Rails apps and also for > pure Ruby apps (including a datawarehouse project), and I''m also using > Rspec like you. I''ve had small issues setting up growl notifications, > but that''s all !Excellent, thanks! Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-14 22:11 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2008 12:03 AM, Thibaut Barrère <thibaut.barrere-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I''m using CruiseControl.rb as well for all my Rails apps and also for > pure Ruby apps (including a datawarehouse project), and I''m also using > Rspec like you. I''ve had small issues setting up growl notifications, > but that''s all !I don''t suppose there''s any way to decouple unit tests from the database in rspec for those models that extend ActiveRecord? I looked at unit_record, but that seems to be for Test::Unit only. If there isn''t, I''m just going to label anything that extends ActiveRecord::Base as an integration test. Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-14 23:02 UTC
Re: Options for a continuous integration environment with RoR?
Ah yes, I''m after something for this too. The problem is that I have 600 tests and they take 300 seconds to run. I also stumbled across unit_record. I''m sure there''s something rspec''y out there. On Jan 15, 2008 8:41 AM, Will Sargent <will.sargent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Jan 14, 2008 12:03 AM, Thibaut Barrère <thibaut.barrere-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > I''m using CruiseControl.rb as well for all my Rails apps and also for > > pure Ruby apps (including a datawarehouse project), and I''m also using > > Rspec like you. I''ve had small issues setting up growl notifications, > > but that''s all ! > > I don''t suppose there''s any way to decouple unit tests from the > database in rspec for those models that extend ActiveRecord? I looked > at unit_record, but that seems to be for Test::Unit only. > > If there isn''t, I''m just going to label anything that extends > ActiveRecord::Base as an integration test. > > Will. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-14 23:54 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2008 3:02 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ah yes, I''m after something for this too. The problem is that I have 600 > tests and they take 300 seconds to run. I also stumbled across unit_record. > I''m sure there''s something rspec''y out there.Looks like the best option is here: http://muness.blogspot.com/2006/12/unit-testing-rails-activerecord-classes.html As far as I can tell, the big problem with isolation is that ActiveRecord depends on the database to tell it what fields it has. I''m not sure that a database is much better than using a config file for schema information in this case... Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-15 00:03 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2008 3:54 PM, Will Sargent <will.sargent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 14, 2008 3:02 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Ah yes, I''m after something for this too. The problem is that I have 600 > > tests and they take 300 seconds to run. I also stumbled across unit_record. > > I''m sure there''s something rspec''y out there. > > Looks like the best option is here: > > http://muness.blogspot.com/2006/12/unit-testing-rails-activerecord-classes.html > > As far as I can tell, the big problem with isolation is that > ActiveRecord depends on the database to tell it what fields it has. > I''m not sure that a database is much better than using a config file > for schema information in this case...D''oh. Haven''t been reading my own posts: schema.rb IS the config file containing schema information in this case. So unitrecord is the way to go. Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Bigg
2008-Jan-15 00:23 UTC
Re: Options for a continuous integration environment with RoR?
And how do we implement this into Rspec? On Jan 15, 2008 10:33 AM, Will Sargent <will.sargent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Jan 14, 2008 3:54 PM, Will Sargent <will.sargent-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > On Jan 14, 2008 3:02 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Ah yes, I''m after something for this too. The problem is that I have > 600 > > > tests and they take 300 seconds to run. I also stumbled across > unit_record. > > > I''m sure there''s something rspec''y out there. > > > > Looks like the best option is here: > > > > > http://muness.blogspot.com/2006/12/unit-testing-rails-activerecord-classes.html > > > > As far as I can tell, the big problem with isolation is that > > ActiveRecord depends on the database to tell it what fields it has. > > I''m not sure that a database is much better than using a config file > > for schema information in this case... > > D''oh. Haven''t been reading my own posts: schema.rb IS the config file > containing schema information in this case. So unitrecord is the way > to go. > > Will. > > > >-- Ryan Bigg http://www.frozenplague.net Feel free to add me to MSN and/or GTalk as this email. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-15 02:46 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2008 4:23 PM, Ryan Bigg <radarlistener-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> And how do we implement this into Rspec?Move your rspec directories to follow the "jfields" method: spec/ unit/ models/ controllers/ functional/ models/ controllers/ Edit spec_helper.rb to be the following: ENV["RAILS_ENV"] = "test" require File.expand_path(File.dirname(__FILE__) + "/../config/environment") require ''spec'' require ''spec/rails'' Create a unit/unit_spec_helper.rb with the following: require File.expand_path(File.dirname(__FILE__) + "/../spec_helper") require ''unit_record'' # Disconnect ActiveRecord from the database # http://blog.jayfields.com/2007/09/rails-how-we-test.html # http://www.dcmanges.com/blog/rails-unit-record-test-without-the-database ActiveRecord::Base.disconnect! And then change the model specs and controller specs to use ''unit_spec_helper.rb'' instead of spec_helper.rb. There is one outstanding bug that I haven''t resolved: request, response and controller have gone away, and you are now required to declare @request, @response and @controller in the before(:each) method. Other than that, it seems to work fine. :-) Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-15 20:18 UTC
Re: Options for a continuous integration environment with RoR?
> There is one outstanding bug that I haven''t resolved: request, > response and controller have gone away, and you are now required to > declare @request, @response and @controller in the before(:each) > method.Okay, it looks like moving the controller specs out of the normal directory tree means there''s no autorecognition of what''s a controller, model, etc. So if you''re using this scheme, you have to define the spec type by hand: describe FooController, "Foo Controller", :type => :controller do end describe FooModel, "Foo Model", :type => :model do end And so on. Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Wilden
2008-Jan-16 04:25 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 14, 2:11 pm, "Will Sargent" <will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I don''t suppose there''s any way to decouple unit tests from the > database in rspec for those models that extend ActiveRecord?I use mock objects and other test doubles with RSpec. A unit test should test a unit, not the full pathway from ActiveRecord through the RAID array. ///ark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Will Sargent
2008-Jan-16 22:39 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 15, 2008 8:25 PM, Mark Wilden <mark-OCn100epQuBBDgjK7y7TUQ@public.gmane.org> wrote:> > On Jan 14, 2:11pm, "Will Sargent" <will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > I don''t suppose there''s any way to decouple unit tests from the > > database in rspec for those models that extend ActiveRecord? > > I use mock objects and other test doubles with RSpec. A unit test > should test a unit, not the full pathway from ActiveRecord through the > RAID array.Can you explain how you mock out the ActiveRecord::Base stuff? Will. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Mark Wilden
2008-Jan-17 00:14 UTC
Re: Options for a continuous integration environment with RoR?
On Jan 16, 2:39 pm, "Will Sargent" <will.sarg...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Jan 15, 2008 8:25 PM, Mark Wilden <m...-OCn100epQuBBDgjK7y7TUQ@public.gmane.org> wrote: > > > I don''t suppose there''s any way to decouple unit tests from the > > > database in rspec for those models that extend ActiveRecord? > > > I use mock objects and other test doubles with RSpec. A unit test > > should test a unit, not the full pathway from ActiveRecord through the > > RAID array. > > Can you explain how you mock out the ActiveRecord::Base stuff?Mocking is definitely more useful at the functional level, where you can simply set up stubs and expectations for the models, then make sure the controller calls them correctly, meanwhile having its own behavior tested. At the unit test level, I use mocks for complicated objects that the object under test has to deal with. As for the object under test itself, it''s just as easy to mock any ActiveRecord::Base methods that you don''t want to go through the database. You might even mock the connection. ///ark --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---