鉴于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服务器启动atHTTP:// localhost:9876 / karma /“
在Socket Chrome上启动Chrome连接31.0.1650执行0 of 3
(跳过3)错误
任何想法为什么甚至不需要遍历网站或查看DOM等的测试都可以找到但不能运行?
答案 0 :(得分:1)
好的,不确定这是否会对任何人有所帮助,但基本上问题是我没有意识到angular-scenario.js不是Karma测试运行套件的一部分,它是在业力测试与testacular运行之前。
angular-scenario.js作为文件的一部分包含在* / .js通配符中。
一旦我将其更改为不再看到它现在似乎正在工作,我想我会期望某些冲突的函数或未定义的东西被抛出,如果类互相混淆了。