aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes jstestdriver and javascript testing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "jstestdriver and javascript testing" Watch "jstestdriver and javascript testing" New topic
Author

jstestdriver and javascript testing

Jason Mayer
Ranch Hand

Joined: Oct 16, 2007
Posts: 31
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

Joined: Oct 03, 2010
Posts: 46
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

Joined: Oct 16, 2007
Posts: 31
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

Joined: Oct 03, 2010
Posts: 46
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

Joined: Nov 10, 2010
Posts: 5
[Hijack removed. Please start your own questions in your own new topics.]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jstestdriver and javascript testing