Captain Obvious
Captain Obvious

Reputation: 785

how to do backbone.js UI testing

So I've created an require.js and backbone.js (actually marionette.js) application that basically is some sort of mobile app builder.

Now I want to create tests for it, basically testing this scenario:

Now I've been searching on google, however since there are so many testing frameworks, i'm not sure which one to pick and which one provides the functionalities I need.

Potentially PhantomJS seems to be something I could use, however please advice me with some specific information.

Thanks.

Upvotes: 1

Views: 541

Answers (1)

wakingrufus
wakingrufus

Reputation: 415

if you want to actually simulate clicks, look into selenium (http://docs.seleniumhq.org/projects/webdriver/)

If you just want to test that your Backbone components(views, controllers, etc) and templates are working correctly, you can use a js test runner such as Karma (http://karma-runner.github.io/0.12/index.html) to run your tests. Sinon can mock out your ajax calls for you as well. It can use PhantomJs as a rendering engine, so you can actually render your views, and use view.$() style DOM inspection to verify the output of your views.

Upvotes: 1

Related Questions