Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Testing nodejs apps

13,570 views

Published on

Published in: Technology, Education
  • Be the first to comment

Testing nodejs apps

  1. 1. Test, test, test…looking for a great guy to test node.js applications
  2. 2. What am I looking for?• It should be easy!• Browser support• Integrate with CI• Born async
  3. 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. 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. 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. 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. 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. 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. 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/

×