1

鉴于 e2e 配置:

module.exports = function(config) {
    config.set({
        basePath: '../',

        files: [
            'E2E/**/*.js'
        ],

        autoWatch: false,

        browsers: ['Chrome'],

        frameworks: ['ng-scenario'],

        singleRun: true,

        proxies: {
            '/': 'http://localhost:8000/'
        },

        plugins: [
            'karma-junit-reporter',
            'karma-chrome-launcher',
            'karma-jasmine',
            'karma-ng-scenario'
        ],

        junitReporter: {
            outputFile: 'test_out/e2e.xml',
            suite: 'e2e'
        },

        urlRoot: '/_karma_/'
    });
};

和场景:

'use strict';

/* http://docs.angularjs.org/guide/dev_guide.e2e-testing */

describe('Mailing App', function () {

    it('should filter the phone list as user types into the search box', function () {
        expect(true).toBe(true);
    });

    it('should filter the phone list as user types into the search box', function () {
        expect(Element('foo').count()).toEqual(1);
    });

    describe('Sample Test', function () {

        beforeEach(function () {
            browser().navigateTo('../../Client/Views/Shared/_Layout.cshtml');
        });

        it('should filter the phone list as user types into the search box', function () {
            pause();
            expect(Element('.ng-binding')).toBeDefined();
        });
    });
});

程序找到了 3 个测试,但没有通过或失败,而是跳过它们。运行脚本(使用 Windows 8.1,git bash)返回说:

Karma v0.12.1 服务器启动于HTTP://localhost:9876/ karma /"

启动 Chrome 连接到套接字 Chrome 31.0.1650 执行 0 of 3

(跳过 3)错误

知道为什么可以找到甚至不需要遍历站点或查看 DOM 等的测试但无法运行吗?

4

1 回答 1

1

好的,不确定这是否会对任何人有所帮助,但基本上问题是我没有意识到 angular-scenario.js 不是 Karma 测试运行套件的一部分,它是在使用 testacular 运行测试的 karma 之前。

angular-scenario.js 作为文件的一部分包含在 * / .js 通配符中。

一旦我将它更改为不再看到它现在似乎正在工作,我猜我会期望某种冲突的函数或未定义的东西被抛出,如果类互相搞砸了。

于 2014-03-24T02:40:03.293 回答