Testing Business Logic in JavaScript

 If you test server side and its a node.js based app then there is the option of kyuri  +  VowsJS . If not then you might be able to get what you want with plain old code comments, writing the tests in  coffeescript  (which is simpler syntax, but compiles to javascript) and any decent javascript unit testing framework, especially if you're using a good javascript MVC framework. If you're into BDD then  Jasmine  should be your first evaluation. Otherwise first check out Mocha (my favourite) for node apps, QUnit if using jQuery heavily &  DOH with Dojo.

You'll also need to decide on the environment you want to run your client side tests in. Ideally your business logic should be decoupled from the UI, but if it's not then  js-test-driver  is a great tool for running tests in real browsers. If you don't need a full browser then try  PhantomJS, it's good and much faster.

你可能感兴趣的:(Testing Business Logic in JavaScript)