News for hackers. Stuff that matters.
Re:Integration testing Backbone.js by scottschulthess on Monday April 30, 2012 @09:13AM (#3909058)
Why not just use capybara and the selenium or webkit drivers?
Re:Integration testing Backbone.js by kjbekkelund on Monday April 30, 2012 @09:23AM (#3909104)
Why write your tests in something else than JavaScript when it's a JavaScript app? We already wrote a lot of unit tests in JavaScript, and our integration tests grew gradually from them, so we didn't feel we needed to add another layer of abstraction on top of regular JS.
Re:Integration testing Backbone.js by hugs on Monday April 30, 2012 @12:43PM (#3910003)
You can write your browser automation tests in JavaScript. See WebDriverJS, Jelly, or PhantomJS.

* http://code.google.com/p/selenium/wiki/WebDriverJs

* http://jelly.io

* http://phantomjs.org/

Re:Integration testing Backbone.js by netzpirat on Monday April 30, 2012 @09:30AM (#3909133)
Jasmine is used for unit testing and you should mock dependencies like faking XHR requests, whereas with Capybara/Selenium you do acceptance tests to test the frontend/backend integration.
Re:Integration testing Backbone.js by kjbekkelund on Monday April 30, 2012 @09:34AM (#3909154)
Another aspect related to this point is that we have a slow backend system and we wanted our JavaScript tests to be blazingly fast, also the integration tests. I hate waiting for tests. Now I can run ours all the time because they don't use any time at all (well, okey, they take a second ...).
Re:Integration testing Backbone.js by mobmad on Monday April 30, 2012 @09:46AM (#3909195)
Also, by using the procedure described in the post you don't need to have a DOM set up. Note that the view has no knowledge of where it is supposed to be rendered on the page. It could be passed into PersonsView with an el option: new PersonsView({ collection: new Persons(), el: $("#persons") });, but instead he chooses to skip that and test on view.$. It will hold the HTML of the view in memory. This lets you write tests for the view without having to setup DOM fixtures and actually render contents to the DOM. Result: tests that are less complex to write and faster to run.
Re:Integration testing Backbone.js by scottschulthess on Wednesday May 02, 2012 @07:26AM (#3918500)
I know, the title of the article was "integration testing" with backbone
Re:Integration testing Backbone.js by brown9-2 on Monday April 30, 2012 @10:42AM (#3909437)
Or even better: use both unit/integration tests of the code itself and browser-based tests like selenium/capybara.