• Like
Testing nodejs apps
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Testing nodejs apps



Published in Technology , Education
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads


Total Views
On SlideShare
From Embeds
Number of Embeds



Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

    No notes for slide


  • 1. Test, test, test…looking for a great guy to test node.js applications
  • 2. What am I looking for?• It should be easy!• Browser support• Integrate with CI• Born async
  • 3. Nodeunit• Pros – Simple and easy to learn – Sandbox feature, great to test client-side code• Cons – Missing high level assertions – Do not allow groups inside groups – Force to call done() for testcases and callback() for setup/teardown every time;
  • 4. Vows• Pros – BDD Style (clean and meaningful syntax) – Extends the node assertions – The tests could be nested or parallelized – Great output when the test fail. – Play nice with coffee script• Cons – Topic; Batches; Context can drive you crazy when begging – No built-in spies – Do not have browser support
  • 5. Mocha• Pros – Different DSLs “interfaces” (TDD, BDD, Expect, qUnit) – Browser support – Highlight slow tests – String diff support – Async tests: You don’t need to call “done” every time like nodeunit does. – before[Each](); after[Each](); could be async as well – Play nice with coffee script – Fun reports• Cons – Do not paralyze tests (I’m not sure it’s a bad thing, cuz it can cause false positive)
  • 6. Jasmine-node• Pros – Long time on the market – Excellent browser support (fixtures and etc)• Cons – WaitFor, although the jasmine-node brings an alternative. – It’s not maintained for the same jasmine team/pivotal
  • 7. Buster• Pros – Hybrid, node and browser testing. – Shipped with xUnit and BDD style – jsTestDriver like to run client-side tests – It’s doesn’t comes with spies but plays nice with Sinon.JS (created by the same guy. Tks Christian J.) – Clear roadmap• Cons – Beta =/. It might brake your tests before becomes stable.
  • 8. Misc.• Assertions – Should.js – Expect.js – Chaijs• Spies – Sinon.js• Utils – Async.js• Running client-side tests from your terminal – Envjs; Phantonjs; Jsdom – jsTestDriver
  • 9. Links• Nodeunit - https://github.com/caolan/nodeunit• Vows - http://vowsjs.org/• Mocka - http://visionmedia.github.com/mocha/• Jasmine-node - https://github.com/mhevery/jasmine-node• BusterJS - http://busterjs.org/• Should.js - https://github.com/visionmedia/should.js• Expext.js - https://github.com/LearnBoost/expect.js• Chaijs - http://chaijs.com/• SinonJs - http://sinonjs.org/• Async.js - https://github.com/caolan/async• Envjs - http://www.envjs.com/• Jsdom - https://github.com/tmpvar/jsdom• Phantonjs - http://phantomjs.org/• jsTestDriver - http://code.google.com/p/js-test-driver/