Is javascript unit testing a good idea? [closed]
I've been wondering this for a while and what framework is the best. I was going to look at JSUnit, but it looks like it's not actively maintained anymore.
Anybody know the pros-cons of the active unit testing frameworks? I would love to benefit from some of your experience.
EDIT: JsUnit... Not JUnit
JavaScript unit testing is a must. Especially on the server.
JavaScript is a weakly typed dynamic language and it's easy to make mistakes, unit testing will allow you to have confidence about the stability of your source code.
Automated unit tests for the server allow you to re factor easily and automated unit tests for the client allow you to assert browser compliance after every change
As for unit testing frameworks I would recommend vows-is for node.js and QUnit for the client-side.
Eventually I will port vows-is to work nicely as a client-side unit testing framework but it's not ready for that yet.
JUnit is for Java - Not Javascript. Javascript runs on the browser - and I cannot think of anyway of unit testing. Javascript is just to make web pages interactive.
If you want to test a web page you need something like Quick Test Pro - for example.
精彩评论