Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript unit testing and continuous integration 2011

Most of the existing questions about unit testing JavaScript code and integrating it into a continuous integration environment seem to date back to the dawn of time (or at least 2008 or 2009 :) ). Even a recent one is from about a year and a half ago:

Running JavaScript unit tests headlessly in a Continuous Integration build

Before I launch into trying to use js-test-driver to build tests and integrate them into Jenkins (nee Hudson), is this still the best approach in 2011?

We've got code that uses JavaScript and jQuery, Lawnchair, lccache, Fancybox, and more. I don't think we have to test all of it, but it would be nice if we could build tests for a reasonable subset. Bonus points if the solution is happy with backbone.js. It's looking more and more likely as time wears on.

like image 599
John Munsch Avatar asked Aug 29 '11 22:08

John Munsch


3 Answers

After some further looking into this, we're going to give Jasmine BDD a try for our testing. It's featured in the PeepCode videos on Backbone.js as well as this excellent article series about testing Backbone.js using Jasmine:

  • http://tinnedfruit.com/2011/03/03/testing-backbone-apps-with-jasmine-sinon.html
  • http://tinnedfruit.com/2011/03/25/testing-backbone-apps-with-jasmine-sinon-2.html
  • http://tinnedfruit.com/2011/04/26/testing-backbone-apps-with-jasmine-sinon-3.html

If we go down this route it appears we may have to combine it with JsTestDriver so we can plug the whole mess into Jenkins.

like image 116
John Munsch Avatar answered Nov 12 '22 21:11

John Munsch


You could run Selenium tests together with Jenkins.

like image 45
powtac Avatar answered Nov 12 '22 19:11

powtac


For reference in case someone stumbles on this later on: there is also TestSwarm (used by the JQuery team) and Buster.js (up and coming JSTestDriver replacement)

like image 1
gotofritz Avatar answered Nov 12 '22 20:11

gotofritz