Using Javascript Unit testing tool Jasmine in Visual studio
Steps. 1. we need to download Jasmine using github. 2. get the jasmine.js file and add it to visual studio empty website under newly created folder Jasmine. 3. Create a new file named TestJasmine.js and include below code in that. /// describe("Math.add", function () { it("can add two numbers", function(){ var result = new Math().add(2, 3); expect(result).toBe(5); }); }); var Math = function() { var add = function (a, b) { return a + b; } return { add: add }; } 4. Install Chutzpah in visual studio using Extensions and Update. This will help run Jasmine testing code with visual studio. 5. Add NuGet package of Chutzpah in project. using Nuget Package Manager. 6. Restart the visual studio. 7. right click on TestJasmine.js and select option to unit test this file. 8. Happy unit testing.