加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

AngularJS Karma-jasmine和视觉工作室2015

发布时间:2020-12-17 07:01:26 所属栏目:安全 来源:网络整理
导读:我有一个angularJS应用程序,现在我想开始测试它. 所以我看了几个教程,但没有一个教你如何使用visual studio 2015设置测试. 有没有人知道一个好的资源阅读或可以帮助我设置它. 我的问题是: 我是否需要为每个测试设置单独的视图? 除了安装karma-jasmine和kar
我有一个angularJS应用程序,现在我想开始测试它.
所以我看了几个教程,但没有一个教你如何使用visual studio 2015设置测试.
有没有人知道一个好的资源阅读或可以帮助我设置它.

我的问题是:

>我是否需要为每个测试设置单独的视图?
>除了安装karma-jasmine和karma-chrome-launcher之外我还需要安装其他东西吗?
>如何在浏览器中查看我的测试?

任何帮助都会很棒.

解决方法

我建议你尝试Chutzpah(可以插入VS2015),它可以与Jasmine一起使用,你可以在VS输出控制台和浏览器中看到测试结果.

Chutzpah on Github

Chutzpah extensions for VS

关于VS2015与Chutzpah的Helloworld示例:

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');
    });
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读