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.
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/
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();
});
Here is an article on using Jasmine to test Ember.js http://www.devmynd.com/blog/2014-1-ember-js-testing-with-jasmine
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With