Working on a testing guide (was: detailed Ember.js testing example)

Has anyone actively compared Konacha to Teaspoon (https://github.com/modeset/teaspoon) for the purpose of this discussion? Note: Teaspoon used to be named “Teabag” but was thankfully renamed.

Both projects appear to be active, but Konacha does not support QUnit while Teaspoon does. I am actively debating how I want to test my Ember applications now.

In addition I am EXTREMELY torn between Qunit/Pavlov vs Mocha/Chai. If I go with Teaspoon I can switch without needing to replace my test runner. I’d love to hear constructive feedback on this if anyone has time.

2 Likes

I started looking at teaspoon last night and the thing that I liked about it is that it’s mounted on the running app meaning it’s possible to use it for integration testing against real data - end to end. Last time I looked, Konacha ran as a separate server so the port is different making that a bit more tricky.

I’m still trying to figure out the data aspect of my integration testing strategy. I started testing against fixtures but I don’t feel confident enough about the integration between my server api and ember-data to continue down that path. Simple things seem to break how ember-data works with the api and i’d like to know about that from my tests.

The next piece of the puzzle from that perspective is how I cleanly seed my database for each test from a javascript environment. One thought I had was to use ember models to do this but it’d mean writing more api than I need in my app and then opening parts of it up under certain conditions that aren’t based on regular authentication. This is at odds with testing access related behaviour in the browser that’s running the tests though.

As far as the unit test framework goes, I started down the path of qunit because of the link with ember itself but that style of testing grates on me and it feels too limiting. I’ve ended up back with jasmine for now with what I believe from my tiny bit of testing, is a working jasmine test adapter for the ember testing package.

EDIT: scratch that last bit. I’m pretty sure my jasmine adapter won’t work reliably. Might be time to look at pavlov.

Today they published some interesting screencast about this:

http://toranbillups.com/blog/archive/2013/07/21/Integration-testing-your-emberjs-app-with-QUnit-and-Karma/

I’ve also added Ember-testing and QUnit to the Master Space and Time With JavaScript book – happy with how it turned out, and I plan an augmenting other examples in the book with Ember-testing integration tests.

Just watched a nice video on unit + integration testing by toranb Integration testing your ember.js app with QUnit and Karma the example code is here : https://github.com/toranb/ember-testing-example ( found the link in this thread thanks @asgarothbelem )

Also, Today I noticed the fist (integartion) testing guide on the Ember website, nice! http://emberjs.com/guides/testing/integration/

I’ve prepared a case study for the Ember testing guide at http://emberjs.com/guides/testing/integration/ The user group I participate in Ember-SC received permission to publish the PeepCode Ordr application source code within a testing repository, at https://github.com/Ember-SC/peepcode-ordr-test so, based on that exercise, I created a pull request for the Ember website testing guide here : https://github.com/emberjs/website/pull/610

This testing example uses QUnit and adds to the already excellent “Integration” testing page:

  • Example Browser Application
  • Fixture Data
  • Testing Setup/Helpers
  • End-to-End Tests
  • Unit Tests

I have a ember-testing w/ QUnit example here: Tech.pro: Ember.js Views and Live Templates with Handlebars.js Part 2. I used ember-data and the FixtureAdapter, and show faking latency. I also added a bit of CSS to spruce up the Ember.js app in the QUnit test runner. The source is available here: https://github.com/jessecravens/techpro-handlebars.