Testing with angular, Karma and Webstorm

So, probably my last post for this year. I’m back to Javascript and agular. 😉 Any book about angular.js tells that testing is super easy. And of course I also believe in the tale of TDD or at least in writing some tests 😉

So I tried to set up an working test environment within my IDE: Webstorm 7.

So a good points to start are a blog article about karma testing in webstorm 7 and of course the jetbrains confluence page.

My main problem was to set up a working karma config file and get the right order of includes to be able to test my application even with angular from CDN.

So my karma.conf.js finally looked like this.

Next step is to right a test for your angular app. This should give you a little impression how it might work. For me it was not that easy understandable how to load modules and how to inject the stuff.

For me next steps are to test controllers and do testing with more dependent components. But at least my service layer can be tested in such manner easily.

So finally I wish everbody a happy new year!

GD Star Rating
Testing with angular, Karma and Webstorm, 8.5 out of 10 based on 2 ratings

Kommentar verfassen

This site uses Akismet to reduce spam. Learn how your comment data is processed.