I was curious what everyone''s code to test ratio is with running rake stats. I''m trying to find what a typical ratio should be. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Daniel Salo wrote:> I was curious what everyone''s code to test ratio is with running rake > stats. I''m trying to find what a typical ratio should be.Code LOC: 2233 Test LOC: 2173 Code to Test Ratio: 1:1.0 Note if this were a greenfield project (no legacy stuff like HTML to slow it down) the test rate would be much higher... -- Phlip http://www.greencheese.us/ZeekLand <-- NOT a blog!!! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Phlip wrote:> Daniel Salo wrote: > Code LOC: 2233 Test LOC: 2173 Code to Test Ratio: 1:1.0 > > Note if this were a greenfield project (no legacy stuff like HTML to slow it > down) the test rate would be much higher... >I hate any comparisons that involve lines of code. For a while when I first discovered rake stats, I justified it to myself by saying well, they''re only using it to get a ratio, not absolute lines of code; so it must be ok. But lately I''ve decided that it''s still ridiculous. How can lines of code at all compare to lines of testing code? If it takes me 6 lines to implement a method, do I really have to come up with 6 or more assertions to get the ratio right? What if two assertions test everything I need to about that method? Or what if I really need 10, then 6 is actually not enough. So please don''t strive for any particular ratio. It''s just there for informational purposes, no more and no less. Jeff softiesonrails.com --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Daniel Salo wrote:> I was curious what everyone''s code to test ratio is with running rake > stats. I''m trying to find what a typical ratio should be.It may be interesting, but it is not informative or useful. The number of tests and the number of lines in those tests should reflect what is required to ensure your application is working correctly. In a similar way, the number of lines in the application is sort of interesting but has little bearing on the functionality or usability the application may have. The only time I have used either of these numbers is to demonstrate how efficient rails is in comparison to another platforms. Striving for a particular number or ratio is fruitless IMHO. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I agree with you, Jeff. It''s just numbers really. A guide. You know if you''re testing enough ''cause you''re testing a lot. As a newcomer to using "rake stats", I was obsessed by getting that ratio above 1:1.0. I soon discovered that [kinda counterintuitively] the DRYer you make your tests [ie, writing out common assertions to test_helper.rb, etc] the LOWER your ratio will be. Good DRY tests ratio looks a lot worse than a repetitive, redundant [yes, I know] one. I still use "rake stats" but only out of curiosity instead of looking for a validation of how good a coder I''m being. [Yes, I need affirmation like that sometimes.] RSL On 1/8/07, Jeff <cohen.jeff-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > > Phlip wrote: > > Daniel Salo wrote: > > Code LOC: 2233 Test LOC: 2173 Code to Test Ratio: 1:1.0 > > > > Note if this were a greenfield project (no legacy stuff like HTML to > slow it > > down) the test rate would be much higher... > > > > I hate any comparisons that involve lines of code. > > For a while when I first discovered rake stats, I justified it to > myself by saying well, they''re only using it to get a ratio, not > absolute lines of code; so it must be ok. > > But lately I''ve decided that it''s still ridiculous. How can lines of > code at all compare to lines of testing code? > > If it takes me 6 lines to implement a method, do I really have to come > up with 6 or more assertions to get the ratio right? What if two > assertions test everything I need to about that method? Or what if I > really need 10, then 6 is actually not enough. > > So please don''t strive for any particular ratio. It''s just there for > informational purposes, no more and no less. > > Jeff > softiesonrails.com > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeff wrote:> > Note if this were a greenfield project (no legacy stuff like HTML to slow it > > down) the test rate would be much higher...> I hate any comparisons that involve lines of code.Our industry in general is recovering from the days when bosses tracked LOC as "progress". Just between engineers, as a ratio, when we are curious, it''s project information like any other... -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---