(contrast stub and mock in java )http://www.cnblogs.com/TankXiao/archive/2012/03/06/2366073.htmljavascript
http://shaynegui.com/javascript-unit-test-sinonjs/css
http://shaynegui.com/javascript-unit-test-sinonjs/html
http://sinonjs.org/docs/#spiesjava
npm install -g faker-cliajax
測試框架 mochanpm
斷言庫:should.js、expect.js、chai框架
覆蓋率:istanbul、jscover、blanket工具
Mock庫:muk單元測試
測試私有方法:rewire測試
Web測試:supertest
持續集成:Travis-cli
QUnit is very easy to get started with, as you only need to include two files(qunit.css and qunit.js) and a little bit of markup, then you can start writing tests. QUnit is TDD style tests.
Jasmine is easier to get started – it’s all-in-one package will generally get you and a team up and testing much faster, and you’ll be in good hands with it. Jasmine is BDD style tests.
Mocha is significantly more flexible, but you have to piece it together yourself. There is no spy framework built in to Mocha, so most people use sinon.js. There’s no assertion framework built in to Mocha either, so you’ll have to pick one. Chai is the popular one, but there are many, many others available. You can also configure Mocha for BDD (jasmine style) or TDD (QUnit style) easily. But you have to pick and choose how you want Mocha to work. This flexibility is great because you can build the test environment that you really want. But it means you have more work to do, more individual pieces to maintain / keep up to date, etc.