r3p*_*ica 6 testing angularjs karma-jasmine visual-studio-2015
我有一个angularJS应用程序,现在我想开始测试它.所以我看了几个教程,但没有一个教你如何使用visual studio 2015设置测试.有没有人知道一个好的资源阅读或可以帮助我设置它.
我的问题是:
任何帮助都会很棒.
我会推荐你尝试Chutzpah(可以插入VS2015),它与Jasmine配合使用,你可以在VS输出控制台和浏览器中看到测试结果。
我在 VS2015 上使用 Chutzpah 的 Helloworld 示例:
你好世界.js:
function helloWorld(){
return "Hello world!";
}
function examples() {
return package = {
first: 13,
second: 13,
third: "gone"
}
}
Run Code Online (Sandbox Code Playgroud)
你好世界规范.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');
});
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1598 次 |
| 最近记录: |