• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jstestdriver and javascript testing

 
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Lately I've been using jsTestDriver (available on google code) for javascript testing. What frameworks (if any) do you use in this book? Also, I've run into problems where methods call window.setTimeout() and I have had no success in mocking out that call... do you discuss mocking and stubbing to any degree? Lately I've just been mocking out the entire method that has troublesome code and then replacing it after the test is completed. Thanks, looking forward to reading your book
 
author
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jason,

You'll be happy to learn that JsTestDriver is the tool used for most examples in the book. The book also covers stubbing and mocking quite extensively, including XMLHttpRequest and setTimeout/setInterval. Additionally, I wrote a stub/mock library while writing the book which does this automatically: Sinon.JS. It's test framework agnostic and works with JsTestDriver out of the box. This article on stubbing timers may be of special interest to you.
 
Jason Mayer
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds awesome! Do you cover the eclipse plugin at all? I've been running all my tests from the command line - haven't had an opportunity to check out the plugin.
 
Christian Johansen
author
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The book has instructions for setting it up, but I don't spend a lot of time on the Eclipse plugin. The book is primarily focused on the concepts of testing, not the tools themselves.

Personally, I prefer the command-line, and use my own autotesting tool for jstestdriver: http://cjohansen.no/en/javascript/jstdutil_a_ruby_wrapper_over_jstestdriver
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[Hijack removed. Please start your own questions in your own new topics.]
 
reply
    Bookmark Topic Watch Topic
  • New Topic