Hello, I''m just wondering if there are some suggestions/docs/tutorials/frameworks on testing the UI in Rails. These days, with all the AJAX and DOM manipulation and whatnot, it seems increasingly important to have some tests in place. TDD would be the ideal, but what are others doing? Thanks, Cliffe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
<fred-/Oy7tj6Mewwfi341S1sti3nhMCiq3JZZ@public.gmane.org>
2006-Sep-07 18:51 UTC
Re: UI Testing
For UI testing, I''ve been using Selenium. Someone wrote an article on using it with Ajax calls. http://www.openqa.org/selenium/ http://agiletesting.blogspot.com/2006/03/ajax-testing-with-selenium-using_21.html --- cliffe.hodgkinson-ypjxgxVNTP7PM7EVW8B8k9BPR1lH4CV8@public.gmane.org wrote: From: "Hodgkinson, Cliffe" <cliffe.hodgkinson-ypjxgxVNTP7PM7EVW8B8k9BPR1lH4CV8@public.gmane.org> To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> Subject: [Rails] UI Testing Date: Thu, 7 Sep 2006 14:18:20 -0400 Hello, I''m just wondering if there are some suggestions/docs/tutorials/frameworks on testing the UI in Rails. These days, with all the AJAX and DOM manipulation and whatnot, it seems increasingly important to have some tests in place. TDD would be the ideal, but what are others doing? Thanks, Cliffe --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
+1 on Selenium. Can''t beat it. On 9/7/06, fred-/Oy7tj6Mewwfi341S1sti3nhMCiq3JZZ@public.gmane.org <fred-/Oy7tj6Mewwfi341S1sti3nhMCiq3JZZ@public.gmane.org> wrote:> > > For UI testing, I''ve been using Selenium. Someone wrote an article on > using it with Ajax calls. > > http://www.openqa.org/selenium/ > > > http://agiletesting.blogspot.com/2006/03/ajax-testing-with-selenium-using_21.html > > --- cliffe.hodgkinson-ypjxgxVNTP7PM7EVW8B8k9BPR1lH4CV8@public.gmane.org wrote: > > From: "Hodgkinson, Cliffe" <cliffe.hodgkinson-ypjxgxVNTP7PM7EVW8B8k9BPR1lH4CV8@public.gmane.org> > To: <rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > Subject: [Rails] UI Testing > Date: Thu, 7 Sep 2006 14:18:20 -0400 > > Hello, I''m just wondering if there are some > suggestions/docs/tutorials/frameworks on testing the UI in Rails. These > days, with all the AJAX and DOM manipulation and whatnot, it seems > increasingly important to have some tests in place. TDD would be the > ideal, but what are others doing? > > Thanks, > Cliffe > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
> > Hello, I''m just wondering if there are some > suggestions/docs/tutorials/frameworks on testing the UI in Rails. These > days, with all the AJAX and DOM manipulation and whatnot, it seems > increasingly important to have some tests in place. TDD would be the > ideal, but what are others doing?you may want to have a look at Watir http://wtr.rubyforge.org/ cheers Thibaut --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hodgkinson, Cliffe wrote:> Hello, I''m just wondering if there are some > suggestions/docs/tutorials/frameworks on testing the UI in Rails. These > days, with all the AJAX and DOM manipulation and whatnot, it seems > increasingly important to have some tests in place. TDD would be the > ideal, but what are others doing?The closest native solution are Rails'' functional tests (also called acceptance tests). With them you can test the HTTP response of a controller action, what instance, session, cookie and flash variables were set, what view was rendered and it even lets you do "tag-based" assertions. While I''ve not played with the tag assertions, from what I understand they check the DOM of the rendered view to make sure that a particular tag exists. The Rails manual book on testing: http://manuals.rubyonrails.com/read/book/5 Controller tests start on chapter 9. Thibaut Barrère wrote:> you may want to have a look at Watir http://wtr.rubyforge.org/That looks interesting. I wonder if it''s worth the effort to learn another testing framework, especially if it only works in IE. I also wonder what benefits it yields over functional tests in Rails. -- 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Check out the testing tool we''ve developed that covers Watir, called Systir: http://atomicobject.com/systir.page Very simple to set up and use, written in Ruby, though only useable in this case in Windows and IE, as Watir can only control IE right now. Jason On 9/7/06, Thibaut Barrère <thibaut.barrere-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Hello, I''m just wondering if there are some > > suggestions/docs/tutorials/frameworks on testing the UI in Rails. These > > days, with all the AJAX and DOM manipulation and whatnot, it seems > > increasingly important to have some tests in place. TDD would be the > > ideal, but what are others doing? > > > you may want to have a look at Watir http://wtr.rubyforge.org/ > > cheers > > Thibaut > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Daniel, the problem here is testing RJS / Ajax code, which Rails Integration tests just cannot do. If you''ve never tried, you''ll very quickly find that all you get back is the javascript, and no more DOM to test. Thus most of the time your stuck with posting certain actions, refreshing the page, and asserting that the new stuff is there. To test actual Ajax (like the opening / closing of an Add form), you need some testing library that runs a browser. Systir combined with Watir very quickly and efficiently allows this ability of testing (I''ve never touched Selenium, but I know there''s a good bit of configuration to it, that isn''t needed with Systir). So you can actually click on a link and then check the DOM, as Watir only cares about what IE thinks the DOM now is, not what the last call was. Watir also has the side effect of ''physically'' driving the browser, so you can choose to watch the test run, checking for yourself whether effects are happening or not, and if certain actions are just taking too long. Jason On 9/7/06, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Hodgkinson, Cliffe wrote: > > Hello, I''m just wondering if there are some > > suggestions/docs/tutorials/frameworks on testing the UI in Rails. These > > days, with all the AJAX and DOM manipulation and whatnot, it seems > > increasingly important to have some tests in place. TDD would be the > > ideal, but what are others doing? > > The closest native solution are Rails'' functional tests (also called > acceptance tests). With them you can test the HTTP response of a > controller action, what instance, session, cookie and flash variables > were set, what view was rendered and it even lets you do "tag-based" > assertions. > > While I''ve not played with the tag assertions, from what I understand > they check the DOM of the rendered view to make sure that a particular > tag exists. > > The Rails manual book on testing: > http://manuals.rubyonrails.com/read/book/5 > > Controller tests start on chapter 9. > > Thibaut Barrère wrote: > > you may want to have a look at Watir http://wtr.rubyforge.org/ > > That looks interesting. I wonder if it''s worth the effort to learn > another testing framework, especially if it only works in IE. I also > wonder what benefits it yields over functional tests in Rails. > > -- > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
I''ve written a plugin to allow tighter integration of Selenium testing with Rails. It uses Selenium-RC to directly control the browser and check the results. I''d class it as alpha level at the moment. It should work alright, but it needs some more work. If anyone wants to try it out and let me know the result that would be great. http://svn.viney.net.nz/things/rails/plugins/selenium_jelly There should be enough documentation to get started. -Jonathan. On 9/8/06, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Daniel, the problem here is testing RJS / Ajax code, which Rails > Integration tests just cannot do. If you''ve never tried, you''ll very quickly > find that all you get back is the javascript, and no more DOM to test. Thus > most of the time your stuck with posting certain actions, refreshing the > page, and asserting that the new stuff is there. > > To test actual Ajax (like the opening / closing of an Add form), you need > some testing library that runs a browser. Systir combined with Watir very > quickly and efficiently allows this ability of testing (I''ve never touched > Selenium, but I know there''s a good bit of configuration to it, that isn''t > needed with Systir). So you can actually click on a link and then check the > DOM, as Watir only cares about what IE thinks the DOM now is, not what the > last call was. > > Watir also has the side effect of ''physically'' driving the browser, so you > can choose to watch the test run, checking for yourself whether effects are > happening or not, and if certain actions are just taking too long. > > Jason > > > On 9/7/06, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > > Hodgkinson, Cliffe wrote: > > > Hello, I''m just wondering if there are some > > > suggestions/docs/tutorials/frameworks on testing the UI in Rails. > > These > > > days, with all the AJAX and DOM manipulation and whatnot, it seems > > > increasingly important to have some tests in place. TDD would be the > > > ideal, but what are others doing? > > > > The closest native solution are Rails'' functional tests (also called > > acceptance tests). With them you can test the HTTP response of a > > controller action, what instance, session, cookie and flash variables > > were set, what view was rendered and it even lets you do "tag-based" > > assertions. > > > > While I''ve not played with the tag assertions, from what I understand > > they check the DOM of the rendered view to make sure that a particular > > tag exists. > > > > The Rails manual book on testing: > > http://manuals.rubyonrails.com/read/book/5 > > > > Controller tests start on chapter 9. > > > > Thibaut Barrère wrote: > > > you may want to have a look at Watir http://wtr.rubyforge.org/ > > > > That looks interesting. I wonder if it''s worth the effort to learn > > another testing framework, especially if it only works in IE. I also > > wonder what benefits it yields over functional tests in Rails. > > > > -- > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
+1 to WATIR. What got me into Ruby. It owns. Unit testing of GUIs, DOM based and the test scripts are very robust if written properly (using ids etc.) Extremely easy to get up to speed with, and straightforward to teach to non-coders. If Firefox is your poison, theres FireWatir but its not as mature. (note to self to check out systir) I haven''t tried Selenium, but my hearsay tells me that it is not a functional overlap of Watir, so between both tools you have very powerful testing capability. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brian Hogan wrote:> +1 on Selenium. Can''t beat it.i second that! -- 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 -~----------~----~----~----~------~----~------~--~---
@Jason: Selenium actually doesn''t require any setup if you just use the Selenium-IDE plugin for Firefox. You can build your tests by recording movements on the page and it writes the scripts for you. When you play them back, it takes control of the browser. It can get more sophisticated if you use the Selenium-RC stuff.... but the Selenium-IDE will let you save your tests (which are actually ruby files!) On 9/7/06, Jason Roelofs <jameskilton-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Daniel, the problem here is testing RJS / Ajax code, which Rails > Integration tests just cannot do. If you''ve never tried, you''ll very quickly > find that all you get back is the javascript, and no more DOM to test. Thus > most of the time your stuck with posting certain actions, refreshing the > page, and asserting that the new stuff is there. > > To test actual Ajax (like the opening / closing of an Add form), you need > some testing library that runs a browser. Systir combined with Watir very > quickly and efficiently allows this ability of testing (I''ve never touched > Selenium, but I know there''s a good bit of configuration to it, that isn''t > needed with Systir). So you can actually click on a link and then check the > DOM, as Watir only cares about what IE thinks the DOM now is, not what the > last call was. > > Watir also has the side effect of ''physically'' driving the browser, so you > can choose to watch the test run, checking for yourself whether effects are > happening or not, and if certain actions are just taking too long. > > Jason > > > On 9/7/06, Daniel Waite <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > > > Hodgkinson, Cliffe wrote: > > > Hello, I''m just wondering if there are some > > > suggestions/docs/tutorials/frameworks on testing the UI in Rails. > > These > > > days, with all the AJAX and DOM manipulation and whatnot, it seems > > > increasingly important to have some tests in place. TDD would be the > > > ideal, but what are others doing? > > > > The closest native solution are Rails'' functional tests (also called > > acceptance tests). With them you can test the HTTP response of a > > controller action, what instance, session, cookie and flash variables > > were set, what view was rendered and it even lets you do "tag-based" > > assertions. > > > > While I''ve not played with the tag assertions, from what I understand > > they check the DOM of the rendered view to make sure that a particular > > tag exists. > > > > The Rails manual book on testing: > > http://manuals.rubyonrails.com/read/book/5 > > > > Controller tests start on chapter 9. > > > > Thibaut Barrère wrote: > > > you may want to have a look at Watir http://wtr.rubyforge.org/ > > > > That looks interesting. I wonder if it''s worth the effort to learn > > another testing framework, especially if it only works in IE. I also > > wonder what benefits it yields over functional tests in Rails. > > > > -- > > 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk -~----------~----~----~----~------~----~------~--~---
Jason Roelofs wrote:> Daniel, the problem here is testing RJS / Ajax code, which Rails > Integration tests just cannot do....Ah, I see. Okies. Thanks for the lesson in testing. =) -- 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 -~----------~----~----~----~------~----~------~--~---
Not strictly about UI testing, but something in that direction: my RailsConf Europe presentation will be about (unit) testing JavaScript (with unittest.js of script.aculo.us, which is also used for the Prototype unit tests). I''ll put up the slides of the presentation after the talk (so, later this week, maybe Friday or so). In my experience, for interface and interaction testing itself you''ll have to do manual tests. For example, all browsers known to man have rendering errors in some situations that you can''t really capture with automated tools-- and while you can tricky with stuff like screenshot comparisions, this will quickly become extremely tiresome in this world of quickly changing apps. The route I''d recommend is: have sane amount of coverage for unit and functional tests for the Rails app, unit tests for your JavaScript libs, and try to have frequent releases. It''s imperative that you check all vital functionality of your app in all supported browsers manually. Best, Thomas Am 07.09.2006 um 20:18 schrieb Hodgkinson, Cliffe:> > Hello, I''m just wondering if there are some > suggestions/docs/tutorials/frameworks on testing the UI in Rails. > These > days, with all the AJAX and DOM manipulation and whatnot, it seems > increasingly important to have some tests in place. TDD would be the > ideal, but what are others doing? > > Thanks, > Cliffe > > >--~--~---------~--~----~------------~-------~--~----~ 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 12/09/06, Thomas Fuchs <t.fuchs-moWQItti3gBl57MIdRCFDg@public.gmane.org> wrote:> > > Hello, I''m just wondering if there are some > > suggestions/docs/tutorials/frameworks on testing the UI in Rails. > > These > > days, with all the AJAX and DOM manipulation and whatnot, it seems > > increasingly important to have some tests in place. TDD would be the > > ideal, but what are others doing?You should take a look at Adam Connors'' and Joe Walnes'' excellent talk "Does my button look big in this? Building Testable AJAX Applications" which they presented at the Google London Test Automation Conference last week. It should be coming out on Google Video any day now. I''ll post it to my blog as soon as it comes out. -- James. http://blog.floehopper.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---