studentsss
studentsss

Reputation: 197

AngularJS testing using Jasmine + Karma in Visual Studio 2013

I am new to Angularjs framework and also testing it using Jasmine framework and Karma. I have a ASP.NET MVC app built with Visual Studio 2013 and I would like to include Jasmine package and Karma in order to test js.

Maybe this issue is already discussed here, but could you please show a tutorial or a demo of how to include a Jasmine file, and test it and show the results? For testing spa app is Jasmine and Karma the best choice?

Could you please show me some steps of where to include Jasmine in project and how to bind it with my .js in order to test it?

Upvotes: 9

Views: 6480

Answers (1)

code4coffee
code4coffee

Reputation: 677

I ran into the same issue - all of the tutorials seem to be based on Node.js. However, I found some excellent resources to get started with from the Chutzpah Javascript Test Runner project. Chutzpah appears to support QUnit, Jasmine, and Mocha testing frameworks. Essentially, install the packages/extensions listed below, follow the Jasmine tutorials for building out unit tests on the Pivotal Gist (or the Angular demo), and you'll be able to right-click (to pull up the context menu) on a Javascript test and run it (selecting the option "Run JS Tests"). Hope these resources help!

Visual Studio Extensions:

Tutorials

Edit: Because it has been linked here, I also threw a blog post together about this - http://codeforcoffee.org/Setting-Up-Angular-JS-Jasmine-and-Karma-in-Visual-Studio

Upvotes: 12

Related Questions