Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

testing ember.js apps with jasmine

Does anyone know of any resources, examples or tutorials about testing ember.js apps ?

How do you test views ?

There does not seem to be any extensive examples / information on this.

like image 325
Rick Moss Avatar asked Jun 28 '12 21:06

Rick Moss


3 Answers

I can't propose an example how you can achieve that, but I have found a project which extensively uses Jasmine for their test: you should take a look at the ember-resource project on GitHub. It uses Jasmine for their tests, which are located in spec/javascripts.

The project also has a Rakefile and corresponding tasks which let you execute the specs in a convenient way.


There is a blog post about testing Ember.js with Jasmine: http://www.thesoftwaresimpleton.com/blog/2012/04/03/testing-ember-and-the-runloop/

like image 85
pangratz Avatar answered Nov 15 '22 19:11

pangratz


You could also use the testing functionality of Ember itself, as described in this post

What is basically does is disabling the Ember runloop by setting: Ember.testing = true This way you don't have to check if your asynchronous code is finished. You simple could wrap it in its own runloop:

// Creating an application normally happens async,
// which is why we have to wrap it in Ember.run
Ember.run(function() {
  App = Ember.Application.create();
});
like image 33
Willem de Wit Avatar answered Nov 15 '22 18:11

Willem de Wit


Here is an article on using Jasmine to test Ember.js http://www.devmynd.com/blog/2014-1-ember-js-testing-with-jasmine

like image 1
bwilken Avatar answered Nov 15 '22 17:11

bwilken