Recently, I''ve started to write unit tests for some of my scripts. In general,it''s no worse in JavaScript than in Ruby or Java. I didn''t have the courage to try Selenium, but had a look at JsUnit. Unfortunately, in Konqueror it produces unfathomable errors and in Firefox it is slow beyond imagination. Anyway, writing tests for functions that are computational or manipulate the DOM is no big deal. What I need is some inspiration how to automatically test code that interacts with the user (popups, drag & drop) or a server. Michael -- Michael Schuerig Nothing is as brilliantly adaptive mailto:michael@schuerig.de as selective stupidity. http://www.schuerig.de/michael/ --A.O. Rorty, The Deceptive Self
An answer to this could be simulating browser events (maybe be recording them...?), and replaying them in all targeting browsers. Also, here as little unit testing script i''ve come up with: http://dev.rubyonrails.org/file/spinoffs/scriptaculous/test/unittest.js See the test.html file in the same dir on how to use. Thomas Am 29.06.2005 um 15:21 schrieb Michael Schuerig:> > Recently, I''ve started to write unit tests for some of my scripts. In > general,it''s no worse in JavaScript than in Ruby or Java. I didn''t > have > the courage to try Selenium, but had a look at JsUnit. Unfortunately, > in Konqueror it produces unfathomable errors and in Firefox it is slow > beyond imagination. > > Anyway, writing tests for functions that are computational or > manipulate > the DOM is no big deal. What I need is some inspiration how to > automatically test code that interacts with the user (popups, drag & > drop) or a server. > > Michael > > -- > Michael Schuerig Nothing is as brilliantly adaptive > mailto:michael@schuerig.de as selective stupidity. > http://www.schuerig.de/michael/ --A.O. Rorty, The Deceptive Self > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >
On Wednesday 29 June 2005 16:14, Thomas Fuchs wrote:> An answer to this could be simulating browser events (maybe be > recording them...?), > and replaying them in all targeting browsers. > > Also, here as little unit testing script i''ve come up with: > http://dev.rubyonrails.org/file/spinoffs/scriptaculous/test/unittest. >js > > See the test.html file in the same dir on how to use.:-) Seems everyone comes up with something like that once in a while... My more simplistic take on the topic is at http://www.schuerig.de/michael/javascript/assert.js two examples are http://www.schuerig.de/michael/javascript/stdext_test.html http://www.schuerig.de/michael/javascript/protoplus_test.html I was frustrated with JsUnit, but wanted to remain more or less compatible with it. Michael -- Michael Schuerig The more it stays the same, mailto:michael@schuerig.de The less it changes! http://www.schuerig.de/michael/ --Spinal Tap, The Majesty of Rock