Hello, Before I started using rails, I never really was one to write unit tests or any types of test suites really. The more I''ve been using rails the more I started to write bigger and more comprehensive test suites (since it is so easy to do it with the rails framework). I pretty much picked up all my test writing habits as I wrote my tests this past year. I never looked into any tips, advice, or instruction on how to write good test suites. So, I was wondering if anybody could offer any insight, pointers, links to resources, or anything really that could help me refine my approach to writing better test suites. How do you look at your software when you try are writing your test suites (it seems like it is a bit hard to do so objectively), how do you get good coverage, what kind of things do you always want to test in a web application, how do you share the load between unit tests and functional tests (for example, the unit tests for a Person model would have extensive validation coverage, but I''m guessing the functional test wouldn''t need quite the same level of depth). In short, how do I know if I am writing good tests for my code? Thanks, -carl --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-01 20:42 UTC
Re: Writing good test suites?
Check out http://bparanj.blogspot.com/2006/11/resources-for-testing-ruby-on-rails.html --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Read the tests in technoweenie''s code ( http://svn.techno-weenie.net/projects/ ). I had no idea what I was doing or what the big deal was until I started reading his code and looking at his tests. Then it was like that instant when you finally figure out what the weird little inexplicable thingy on your Swiss army knife is used for, and just for a minute you feel like you''re MacGuyver. - foobario On 11/1/06, Carl Lerche <carl.lerche-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > Hello, > > Before I started using rails, I never really was one to write unit > tests or any types of test suites really. The more I''ve been using > rails the more I started to write bigger and more comprehensive test > suites (since it is so easy to do it with the rails framework). I > pretty much picked up all my test writing habits as I wrote my tests > this past year. I never looked into any tips, advice, or instruction > on how to write good test suites. > > So, I was wondering if anybody could offer any insight, pointers, > links to resources, or anything really that could help me refine my > approach to writing better test suites. How do you look at your > software when you try are writing your test suites (it seems like it > is a bit hard to do so objectively), how do you get good coverage, > what kind of things do you always want to test in a web application, > how do you share the load between unit tests and functional tests (for > example, the unit tests for a Person model would have extensive > validation coverage, but I''m guessing the functional test wouldn''t > need quite the same level of depth). > > In short, how do I know if I am writing good tests for my code? > > Thanks, > -carl > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-02 15:08 UTC
Re: Writing good test suites?
Pragmmatic Unit Testing is an excellent book on this topic. Check it out. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Nov-02 15:20 UTC
Re: Writing good test suites?
> > In short, how do I know if I am writing good tests for my code? >When you don''t have any bugs in your code, you know that you are writing good tests. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On 2-Nov-06, at 10:20 AM, bcparanj-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:> > >> >> In short, how do I know if I am writing good tests for my code? >> > > When you don''t have any bugs in your code, you know that you are > writing good tests.you might consider rcov - provides C0 test coverage analysis. "Code coverage shouldn''t be abused (in few words, C0 coverage guarantees nothing) but it''s still useful for testing: it will at least tell you when your tests need more work, and most importantly where." [1] [1]http://eigenclass.org/hiki.rb?rcov J --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---