Which JavaScript unit testing framework should I use with Backbone.js and why?
-
JavaScript MVC framework Backbone.js is very useful but I wonder how developers do unit testing to keep quality. I also use underscore.js/jquery
-
Answer:
For unit tests that might test particular functions in your Models and Collections, you can consider standard JavaScript testing suites, such as QUnit (http://docs.jquery.com/QUnit), or BDD test suites, such as Jasmine (http://pivotal.github.com/jasmine/). Use these to test individual functions as you would for testing any other JavaScript application (in fact, Backbone.js itself uses QUnit for its own unit testing). For functional tests where you want to see how users would actually interact with your web application, consider using Selenium (http://seleniumhq.org/) or PhantomJS (http://phantomjs.org/) with the above testing frameworks to automate actual browser motions that would be performed by your users. There's also tools like Yeti (http://yeti.cx/), though I believe Yeti only works with the YUI Test framework at the moment, to quickly test on multiple browsers at the same time. In the end, testing a Backbone.js app is really no different than testing any other large-scale JavaScript application, so as long as you know what existing tools are out there, you can use it for Backbone as well as anything else.
Clarence Leung at Quora Visit the source
Other answers
Give testacular (http://vojtajina.github.com/testacular/) a try. Yeoman (http://yeoman.io), a combined set of tools to build "modern webapps", comes with a testacular out of the box.
Andreas Klein
I wrote an article how to use Selenium for Acceptance Testing http://alex-craft.com/blog/2014/acceptance-testing-for-web-app Tools: WebDriver (Selenium or Phantom.js), wd.js, node.js, mocha.js. There's also an example with explanation how to use meaningful names instead of CSS selectors, eventual conditions, etc.
Alexey Petrushin
Related Q & A:
- Which preposition should I use?Best solution by German Language
- What framework must I use to develop mobile native application?Best solution by Stack Overflow
- Which one is better? And Can I use it for single speed?
- Why does my laptop freeze when i scroll and why cant i use my taskbar?Best solution by Yahoo! Answers
- Which fishing rig should I use?Best solution by thefisherman.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.