Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular JS unit testing tutorials with examples

I am new to karma-jasmine unit testing for Angular js. So guys please can u share good tutorials?

like image 358
Thirumal Sakthivel Avatar asked Nov 14 '14 10:11

Thirumal Sakthivel


2 Answers

First of all, and most IMPORTANT:

Unit-testing is similar in all other languages.

You have to keep in mind the main features of writing testable code.

Note: There is a good Pluralsight video ( Which cost money ) by Misko Hevery on Writing Testable Code).

First: Watch this youtube by Vojta Jina - Installing and Starting Karma, the person who wrote karma.

Second: Watch this 1 Hour tutorial which I highly recommand : Introduction to AngularJS Unit Testing By Jim Levin

After you complete those you should be able to test every piece of code in your Angular Project.

Good Luck.

like image 95
Linial Avatar answered Oct 16 '22 11:10

Linial


I've written a number of tutorials detailing how to get up and running with Karma and Jasmine for Unit Testing in AngularJS. I've also written a series of posts detailing ngMock in depth, which is Angular's own module that provides support for testing controllers, services etc in isolation.

Here's a link to a page that lists all these articles: AngularJS Unit Testing Tutorials

like image 30
Bradley Braithwaite Avatar answered Oct 16 '22 11:10

Bradley Braithwaite