Win a copy of Microservices Testing (Live Project) this week in the Spring forum!
  • 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
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

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.]
 
Their achilles heel is the noogie! Give them noogies tiny ad!
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic