My Rails application has almost as much (and maybe more) JavaScript as it does Ruby code, and I''m wondering what the best option is for testing it. Has any consensus developed regarding the best way of testing JavaScript code in a Rails application? How are people testing JavaScript in their own applications? Thanks, --Paul --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
There are some answers to your question here. First of all, there''s javascript_test, built for script.aculo.us testing, and uses their own testing framework: http://svn.rubyonrails.org/rails/plugins/javascript_test/ I''ve built another plugin around this concept, but using jsUnit instead and added code generators to make it easier to build up Javascript code source and test trees. I haven''t released anything yet (both me just not doing it and need to make sure I''m not breaking any licensing of the original javascript_test). Send me an email if you want to check out what I''ve done and I''ll send you the code. One of these days I''ll clean up the plugin and release it officially. Jason On 10/22/07, Paul E. G. Lynch <plynchnlm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > My Rails application has almost as much (and maybe more) JavaScript as > it does Ruby code, and I''m wondering what the best option is for > testing it. Has any consensus developed regarding the best way of > testing JavaScript code in a Rails application? How are people > testing JavaScript in their own applications? > > Thanks, > --Paul > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Paul E. G. Lynch wrote:> My Rails application has almost as much (and maybe more) JavaScript as > it does Ruby code, and I''m wondering what the best option is for > testing it. Has any consensus developed regarding the best way of > testing JavaScript code in a Rails application? How are people > testing JavaScript in their own applications?I test the JS one-liners that appear inside HTML attributes (such as onclick) using assert_javascript. This has the benefit of being a true unit test, without the overhead of invoking a web browser against its optimization profiles. -- 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 -~----------~----~----~----~------~----~------~--~---