6

I am going to implementing unit testing in my application and for that I have chosen Karma. But I am struggling regarding how to write the test cases using Karma syntax. Please give me some starting resources and tutorial links regarding Karma syntax.

hassan
  • 7,812
  • 2
  • 25
  • 36
Utpal
  • 805
  • 4
  • 15
  • 44

1 Answers1

22

My favorites resources for starting karma was those articles

http://www.yearofmoo.com/2013/01/full-spectrum-testing-with-angularjs-and-karma.html

You should also check the jasmine syntax for writing tests at http://jasmine.github.io/

and how to configure karma http://karma-runner.github.io/0.12/config/configuration-file.html

I hope it helps you

Mehul Tandale
  • 331
  • 1
  • 5
  • 17
Jorge Guerola
  • 2,072
  • 1
  • 16
  • 18
  • thanks for your reply but I want to know more about how to test controller and factories in angularjs. Specialy how to test the backend webservices. Can you please help me on that. – Utpal Feb 18 '14 at 14:15
  • 1
    Check the first article, its really explicit. For test backend webservices you should use fake data with $httpbackend http://docs.angularjs.org/api/ngMock/service/$httpBackend – Jorge Guerola Feb 18 '14 at 14:22
  • 2
    That yearofmoo.com article is really out of date and the depednencies don't resolve currectly. https://github.com/yearofmoo-articles/AngularJS-Testing-Article/issues – A F Feb 13 '15 at 18:00