Reputation: 13397
I have an angularJS application and now I would like to start testing it. So I have watched a few tutorials, but none of them show you how to set up testing with visual studio 2015. Does anyone know about a good resource to read or can help me set it up.
The questions I have are:
Any help given will be awesome.
Upvotes: 6
Views: 1640
Reputation: 65
If you are using karma jasmine test runner then you don't have to setup anything in vs15, karma runs the test in it's own virtual server and you can see the result in the console it self. And if you want debug your test as well as your file then in the chrome browser you'll see the debug button press that and in the next window press f12 key to get the developer window in chrome. Also Chutzpah is good but karma jasmine is best for Angular JS testing. Also karma is very easy to setup and use.
Upvotes: -1
Reputation: 527
I will recommend you to try Chutzpah (can be plugged in VS2015), it works with Jasmine, you can see test results in the VS output console and also in browser.
My Helloworld examples on VS2015 with Chutzpah:
helloworld.js :
function helloWorld(){
return "Hello world!";
}
function examples() {
return package = {
first: 13,
second: 13,
third: "gone"
}
}
helloworldspec.js :
/// <reference path="helloworld.js" />
describe("Hello world", function () {
it("says hello", function() {
expect(helloWorld()).toContain("Hello");
});
});
describe("Examples", function () {
it("examples", function () {
expect(examples().first).toBe(13);
expect(examples().third).not.toBe(13);
expect(examples().third).not.toMatch(/gz/);
expect(examples().third).toMatch('go');
});
});
Upvotes: 3