Testing an Ember app for dummies


#1

I’m new to (Javascript) testing and would like to learn how to do it. As I have to write tests with Jasmine for our Ember app, I’d like to ask you for some help.

The first question is about the scope of testing. What should I test? Should it be:

  • models
  • controllers
  • views
  • templates
  • bindinds
  • what else?

Where should I start? Books, online resources, whatever? I have the ‘Testable JavaScript’ book but it makes my head spin because it has a lot of jargon and theory - things that are of not particular interest when you start. It is extremely dull to me to boot!

I’m looking for some materials so that I could get the general idea of BDD. Something for beginners not for pros or ninajs.

Having an existing app, what tests should I write first? It’s our internal app, it’s quite simple and I’d like to write tests for it to learn. I know that for some time my tests will be of poor quality but it takes practice. :slight_smile:

Thanks in advance!


#2

Ember has good unit tests you can use as examples…

I would test every method on the Routers/Controllers/Models that you added yourself. You should look into mocha, and maybe selenium as well for higher-level acceptance testing.


#3

Could you give me a link to Ember specs? I tried to find them but couldn’t :frowning:


#4

it’s all under the project’s packages/%package%/test folder

https://github.com/emberjs/ember.js/tree/master/packages/ember-views/tests/views - for example, there’s tons more…

ember-data has nice integrations tests as well.


#5

A few of the members of the OC Ember meetup put together a repo for exploring integration testing of an ember app. We started with the peepcode ordr app (from their training video) see: https://github.com/Ember-SC/peepcode-ordr-test


#6

thanks! I really find such helpers like visit very helpful!