How do you unit test your javascript

Posted by Erin on Programmers See other posts from Programmers or by Erin
Published on 2011-03-02T18:54:06Z Indexed on 2014/05/29 21:59 UTC
Read the original article Hit count: 284

Filed under:
|

I spend a lot of time working in javascript of late. I have not found a way that seems to work well for testing javascript. This in the past hasn't been a problem for me since most of the websites I worked on had very little javascript in them. I now have a new website that makes extensive use of jQuery I would like to build unit tests for most of the system.

My problems are this.

  • Most of the functions make changes to the DOM in some way.
  • Most of the functions request data from the web server as well and require a session on the service to get results back.

I would like to run the test from either a command line or a test running harness rather then in a browser.

Any help or articles I should be reading would be helpful.

© Programmers or respective owner

Related posts about JavaScript

Related posts about unit-testing