不能用业力运行e2e测试(用于角度)

时间:2013-07-01 15:24:01

标签: testing angularjs karma-runner angularjs-e2e

我可以运行单元和中途测试,但是当我想运行e2e测试时,没有任何反应。由于业力的输出表明没有找到测试:

C:\>karma start
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser IE
INFO [IE 10.0 (Windows)]: Connected on socket id 8lG9jAG8mloBmjFez5V9
IE 10.0 (Windows): Executed 0 of 0 SUCCESS (0.125 secs / 0 secs)

我的karma.conf文件如下:

files = [
 JASMINE,
 JASMINE_ADAPTER,
 'Scripts/libs/jquery/jquery-*.js',
 'Scripts/libs/angular/angular.js',
 'Scripts/libs/angular/angular-mocks.js',
 'Scripts/libs/angular/angular-resource.js',
 'Scripts/libs/angular/angular-scenario.js',
 'Scripts/sinon-1.7.3.js',
 'app/**/index.js', 
 'app/**/*.js',
 'app/*.js',
 'test/unit/**/*.js',
 'test/midway/**/*.js',
 'test/e2e/*.js'
];


reporters = ['progress'];
port = 9876;
runnerPort = 9100;
colors = true;
logLevel = LOG_INFO;
autoWatch = true;
browsers = ['IE'];
captureTimeout = 60000;
singleRun = false;
proxies = {
   '/': 'http://localhost:1506/portal.web'
};

知道什么是错的吗?

5 个答案:

答案 0 :(得分:4)

我有同样的问题 - 几乎放弃了 - 但跟着http://blog.diniscruz.com/2013/06/running-karmas-angularjs-example.html - 它有效!

答案 1 :(得分:3)

AngularJS团队建议Protractor进行E2E测试,并将Karma仅用于单元测试。

答案 2 :(得分:0)

setting up karma for e2e testing

您还需要在karma.conf.js中的文件中注释掉JASMINE和JASMINE_ADAPTER,并在其下添加frameworks =“jasmine”。  希望这有帮助

答案 3 :(得分:0)

    // frameworks to use
                frameworks: ['jasmine']

在配置文件中添加以上这些行为我工作。

根据[https://github.com/ksunair/introtokarma] [1]

答案 4 :(得分:0)

frameworks: ['jasmine'],

files: [
    //adapter - ignore deprecation warnings karma spits out -- you need this!
    //JASMINE, 
    //JASMINE_ADAPTER,
    ANGULAR_SCENARIO,
    ANGULAR_SCENARIO_ADAPTER,

    //includes
    'client/common/vendor/angular.js',

    //own files
    'client/admin/views/admin.html',

    //tests
    //'test/client/*-unit-spec.js',
    'test/client/*-e2e-spec.js'
]

(对于ANGULAR_SCENARIO,您将完成npm install karma-ng-scenario --save-dev

Jasmine不是E2E,E2E(虽然它看起来大致相同)不是Jasmine。你需要包括其中一个,而不是两个。

有关详情,请参阅this answer

FWIW,我的版本:

  • 业力:0.10.8
  • karma-ng-scenario:0.1.0
  • karma-jasmine:0.1.5