Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

jstestdriver and javascript testing

 
Jason Mayer
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • 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
 
Christian Johansen
author
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
  • 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
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
  • 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
 
m coffee
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[Hijack removed. Please start your own questions in your own new topics.]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic