Recommended Testing Solution?


With the release of ember-testing (thanks @ebryn !) what are some of the guidelines behind best practices for testing your Ember app?

We had discussed some potential solutions in Testing Ember Apps: how do you do it?. But mostly everyone is using different solutions and hacking things together to get them to work. I think if we can come up with a recommended set of steps, we can get a lot more force behind a great testing solution (and start publishing that recommendation).

Here are some observations so far:

  • There seems to be some consensus that integration tests make more sense than unit testing (except for complicated methods/models).
  • It looks like QUnit is the framework of choice.

The biggest question I have so far is: is it better to test full stack (async) vs using a framework like sinon.js to mock AJAX calls? (I’ve done some tests with Sinon and it is really fast.)

@joefiorini started doing a pull request for a guide on how to test apps. And I’d like to help if I can, but want to get the community / core’s input on what they see as best practices around setting up tests.

What other best practices have you figured out as you’ve tested an app? And what should be the “recommended way”?


Hi @ryanjm

I’m currently quite stuck with getting any kind of unit testing working with ember data 1.0.0. It seems kind of impossible to simply load (model) objects out of the context of a router or a controller (or another context that has had the store injected-into via the DI framework of Ember).

I’d love to know your thoughts about this, because I’m trying to do TDD at the moment and pretty much failing (I’ve been bashing my head against it for a couple of days now - which is a very long time).


Hey @JulianLeviston,

It has been a couple weeks since I’ve had a chance to do Ember development at all and I kind of put testing on pause till more information about ember-testing comes out. I know I got qUnit working but it did require a lot of digging around and finding any resource I could about Ember testing. Erik has done a couple videos on Ember and one or two are about testing.

Here is a blog post I wrote about testing awhile back, not sure how helpful it will be though.

Sorry I can’t be more help. As I get back into Ember development in the next couple of weeks I’ll be looking into Ember’s current state of development.


Hey @ryanjm no worries! I actually got it working in the end. Thanks for the reply. I’ll go read your blog post if I haven’t already, anyway :wink:

I am using ember data 1.0.0 beta2, so I was having trouble grabbing the store. I ended up using a trick I found on a stack overflow somewhere, by setting a reference to it in the setup() qunit function of my tests. For interest, the call is a private method call to the application container: store = App.__container__.lookup("store:main"). Not the best thing in the world, but it got my tests running and that’s the main thing at this stage.